[英]How to test int equality with ShouldBe
I am running c# tests using ShouldBe and I have this code: 我正在使用ShouldBe运行c#测试,并且我有以下代码:
int x = 3;
int y = 3;
x.ShouldBeSameAs(y);
Problem is it throws exception: 问题是它引发异常:
An exception of type 'Shouldly.ShouldAssertException' occurred in Shouldly.dll but was not handled in user code “ Shouldly.ShouldAssertException”类型的异常在Shouldly.dll中发生,但未在用户代码中处理
Additional information: x 附加信息:x
should be same as
3 3
but was
3 3
How can I test equality of to integers with ShouldBe? 如何使用ShouldBe测试与整数的相等性?
只需使用ShouldBe
:
x.ShouldBe(y);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.