fluent-assertions

    5熱度

    1回答

    FluentAssertions似乎當我嘗試比較兩個集合與零點 [Test] public void DeepWithNulls() { var l1 = new List<string> { "aaa", null }; var l2 = new List<string> { "aaa", null }; l1.Should().Equa

    4熱度

    1回答

    什麼是比較兩個對象的所有屬性,其中一些人有不同的格式(例如,在一個DateTime和DateTime.ToString()與其他自定義格式)的最佳方式的對象? 我能夠通過使用2個斷言來做到這一點: o1.ShouldHave().AllPropertiesBut(dto1 => dto1.Date).EqualTo(o2); o1.Date.Should().Be(DateTime.Parse(

    2熱度

    4回答

    的此代碼工作正常 [Test] public void boo() { var collection = new[] { 1, 2, 3 }; collection.Should().Equal(1, 2, 3); } 但是,這種失敗 [Test] public void foo() { var collec

    6熱度

    1回答

    我正在爲一個實用程序庫編寫一些單元測試,當我遇到一個測試時,我預計會失敗,實際通過。該問題與比較兩個變量float變量相比,與比較一個變量float?和一個float變量有關。 我同時使用NUnit的最新版本(2.6.0.12051)和FluentAssertions(1.7.1),和下面是一個小代碼剪斷說明問題: using FluentAssertions; using FluentAsse

    1熱度

    1回答

    我有一個簡單的類: public class MyClass() { public string Property1 {get;set;} public string Property2 {get;set;} } 有什麼辦法來asssert此類平等的兩個實例沒有平等法實施(我猜可能反映很好適應這裏)?我不想僅僅爲了測試而實現Equal)。