c# – FluentAssertions断言单个对象的多个属性
发布时间:2020-12-15 08:30:00 所属栏目:百科 来源:网络整理
导读:有没有办法使用FluentAssertions做这样的事情 response.Satisfy(r = r.Property1== "something" r.Property2== "anotherthing")); 我试图避免编写多个Assert语句.这可能是我用了最长时间的https://sharptestex.codeplex.com/.但SharpTestEx不支持.Net Core.
有没有办法使用FluentAssertions做这样的事情
response.Satisfy(r => r.Property1== "something" && r.Property2== "anotherthing")); 我试图避免编写多个Assert语句.这可能是我用了最长时间的https://sharptestex.codeplex.com/.但SharpTestEx不支持.Net Core. 解决方法
您应该能够使用通用匹配断言通过谓词验证主题的多个属性
response.Should() .Match<MyResponSEObject>((x) => x.Property1 == "something" && x.Property2 == "anotherthing" ); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |