http://www.cnblogs.com/forcertain/archive/2011/10/17/2215305.html
var component = GetComponentService<ShopOperatorComponent>();
var ex = Assert.Throws<BaseMESException>(() => component.StartTask("Order3001.006"));
Assert.That(ex.Message, Is.StringContaining("物料准备状态必须为就绪"));
简单说明:BaseMESException为异常的类型,component.StartTask("Order3001.006")为要测试的方法。