單元測試框架NUnit 之 assertions 斷言

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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章