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")爲要測試的方法。