Почему TestAddition приводит к 12 вместо o 13? Оно должно быть 5 + 1 + 7 = 13, но утверждают, терпит неудачу сДополнение с преинкрементной потерей 1
Ожидаемое: 13
Но было: 12
int method(int a)
{
return 7;
}
[Test]
public void TestAddition()
{
int row = 5;
row += method(++row);
Assert.AreEqual(13, row, "Why is it twelve instead of 13?");
}
[C# Pre- & Post Increment confusions] (http://stackoverflow.com/questions/8573190/c-sharp-pre-post-increment-confusions) –