开发者

Is the order of the two parameters in Assert.AreEqual(expected, actual) important?

开发者 https://www.devze.com 2023-01-20 04:45 出处:网络
I wonder if the order is important?开发者_C百科 What do you think?Well, primarily it\'s important so that if the test fails, the failure message is correct. Otherwise you\'ll be chasing your tail tryi

I wonder if the order is important?开发者_C百科 What do you think?


Well, primarily it's important so that if the test fails, the failure message is correct. Otherwise you'll be chasing your tail trying to work out why the expected value looks wrong but the actual value looks right.


It's needed so you have readable failure messages. If your tests fails, you'll get something like

Assert.Equal failed: value should have been X, but was Y

it would be confusing if X and Y were switched

0

精彩评论

暂无评论...
验证码 换一张
取 消