2
Vote

Throws and DoesNotThrow

description

Instead of having context.Assert.Try( ... ) have context.Assert.Throws and DoesNotThrow. You would not need the ExpectedExceptionAttribute anymore, instead these methods would simply throw an exception if the assert fails.

comments

ndibek wrote Aug 13, 2008 at 5:03 PM

Since NUnit (v 2.5), xUnit are standardizing on that syntax I would say it will make more sense for the folks moving from those platforms to Silverlight/UD. It aslo seems to state the intention more directly when compared with context.Asert.Try() and context.Assert.Fail() combination that are supposed to produce Assert.Throws() behavior. Aslo Assert.DoesNotThrow() seems (to me) more logical then Assert.Try()

justinc wrote Dec 13, 2010 at 5:53 PM

Agreed. Good idea.

justinc wrote Mar 5, 2011 at 1:53 AM

Do you really need a DoesNotThrow? Isn't that already tested automatically? Doesn't an unhandled exception essentially violate this rule?