shouldly

    6熱度

    1回答

    有沒有辦法用異常地測試異常消息? 一個例子: public class MyException: Exception{ } 的方法進行測試: [TestMethod] public void Test() { try { new ClassUnderTest().DoSomething(); Assert.Fail("Exception not

    0熱度

    2回答

    我使用shouldBe這樣運行的C#測試INT平等,我有這樣的代碼: int x = 3; int y = 3; x.ShouldBeSameAs(y); 問題是它會拋出異常: 類型的異常'Shouldly.ShouldAssertException'發生在 Shouldly.dll中但未在用戶代碼中處理 其他信息:X should be same as but was 我如何測試

    0熱度

    1回答

    由於一些日子在Visual Studio中的所有我的C#單元測試我的本地機器上運行正在籌集以下TypeInitializationException到達第一Shouldly語句時:與內部異常 The type initializer for 'Shouldly.ShouldlyConfiguration' threw an exception Illegal characters in pat

    16熱度

    2回答

    Shouldly assertion library for .NET以某種方式知道斷言方法被調用了什麼表達式,所以它能夠將它顯示在消息中。我試圖找出它是如何工作的,但在源代碼中丟失了。我懷疑它看着編譯的代碼,但我真的很想看看這是怎麼發生的。從文檔 map.IndexOfValue("boo").ShouldBe(2); // -> map.IndexOfValue("boo") should b