NUnit will do the same. Like any other test environment, I think, but I only know MStest and NUnit in C #.
I would expect your test code to not contain Decimal.TryParse , but your business logic will do this, which you would check with an object and a method call.
Something like:
var sut = new Sut(); var d = sut.DoSomethingThatReturnsTheDecimal(item.Value); Assert.AreEqual(0.123, d, string.Format("passed value can not be parsed to decimal ({0})", item.Value);
To get a little closer to your implementation:
List<Decimal> consArray = new List<decimal>(); Decimal d = Decimal.MinValue;
In any case, to answer your question. AssertFailedException -catch is AssertFailedException catch your AssertFailedException .
PS: Capturing an AsserFailedException and AsserFailedException will also work, but for me it is a bit strange. I would try to leave Assert out of any try-catch blocks. But this can only be my opinion, which you did not ask for :).
bas
source share