fluent-assertions

    1熱度

    1回答

    我試圖使用流利斷言驗證投影到其自身的軸線的矢量接近或者v.Length()或-v.Length()之一。 我可以斷言,投影近似:result.Should().BeApproximately(v.Length()) 或者我可以斷言,投影的幾個結果之一:result.Should().BeOneOf(v.Length(), -v.Length()) 我怎樣才能將二者結合起來?

    1熱度

    2回答

    我想使用Fluent Assertions ShouldBeNull()擴展方法來聲明我的實例確實爲null。 Result.ShouldBeNull(); 顯然,這會引發異常,因爲我無法在空實例上調用擴展。 System.NullReferenceException 如何正確使用Fluent斷言來做出斷言?

    1熱度

    1回答

    我有這樣一個說法: validationResults.Select(result => result.Tag).ToList().Should().Contain(ServiceContractRuleKey.MedicalDeclarationNumberRequired "because a validation error should be added that the MedicalD

    0熱度

    2回答

    我想用與MINITEST result.should_be "my result" result.should_be_true result.should_contain "foo" 有一些寶石添加此功能流利斷言類型的語法? 我的請求來自similar idea in C#。

    2熱度

    2回答

    我想要一個單元測試來驗證以正確順序發生的兩個函數調用。在本例中,第一個函數對文件進行加密並將其保存到文件系統,第二個函數將加密文件發送到第三方處理器(通過FTP)。 我使用NSubstitute作爲模擬框架和FluentAssertions來幫助進行測試驗證。這看起來並不像你可以用NSubstitute開箱即可實現的。 public void SendUploadToProcessor(Strea

    7熱度

    1回答

    我有一個測試,驗證方法的集合輸出。測試的這種變化通過: [TestMethod, TestCategory("BVT")] public void TheStatusesAreReturned() { var expectedUnprocessedStatuses = new List<FileUploadStatus> { FileU

    3熱度

    2回答

    我有兩個雙數組。有沒有一種方法使用FluentAssertions來逐個比較數組,使用.BeApproximately()技術? 一個範圍值就足夠整個陣列。 實施例: double[] source = { 10.01, 8.01, 6.01 }; double[] target = { 10.0, 8.0, 6.0 }; // THE FOLLOWING IS NOT IMPLEMENTE

    0熱度

    1回答

    我必須考慮到只有共享屬性比較兩個集合。 如果我瞭解丹尼斯對How to combine collection and property assertions using fluent-assertions?的評論,則應該從2.0版開始工作。 我使用這個API: ActualOes.ShouldHave().SharedProperties().EqualTo(expectedOes); Act

    0熱度

    3回答

    給定一個具有多個屬性的對象,例如System.Drawing.Rectangle,我想聲明所有屬性的值(當ONE屬性不匹配時不會停止)並報告所有屬性。 我嘗試這個代碼,希望它會做什麼,我想...... System.Drawing.Rectangle croppingRectangle = SomeMethodReturnsRectangle(testP1,testP2); Assert.Tha

    2熱度

    2回答

    我想比較2個對象expectedItems和resultItems IEnumerable<IDictionary<string, object>>型但一直沒能做到多用它。 此外,一個字典在代碼中初始化,另一個字典是從外部API的JSON響應中構建的。因爲JSON並不關心對象內屬性的順序,所以排除SequenceEquals。 我有兩個相等的對象,所有的這些低調的方法失敗, 首先, Collect