locked
Why does Assert.AreEqual not fail? RRS feed

  • Question

  • Hi,

    there seams to be something I am missunderstanding (or is it a bug in MSTest?):

    the following screenshot shows a situation where I would have exprected Assert.AreEqual to fail, but is doen't. But the following if statement proofs, that expected and actual are not equal!

    Thanks for any reasonable explanation to this mystery!

    Regards
    Rainer


    Monday, November 3, 2014 9:52 AM

Answers

  • Check the value of the third parameter delta(in your case i) which plays the significant role in the comparison as the required accuracy.

    The assertion will fail only if expected is different from actual by more than delta( i in you case).

    • Marked as answer by Rainer Queck Monday, November 3, 2014 10:43 AM
    Monday, November 3, 2014 10:22 AM

All replies

  • Check the value of the third parameter delta(in your case i) which plays the significant role in the comparison as the required accuracy.

    The assertion will fail only if expected is different from actual by more than delta( i in you case).

    • Marked as answer by Rainer Queck Monday, November 3, 2014 10:43 AM
    Monday, November 3, 2014 10:22 AM
  • Thanks a lot!

    I wasn't aware of the "delta" and thought it would be the "message".

    Regards
    Rainer

    Monday, November 3, 2014 10:43 AM