Throws and DoesNotThrow


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.


ndibek wrote Aug 13, 2008 at 4: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 4:53 PM

Agreed. Good idea.

wrote Dec 13, 2010 at 4:54 PM

justinc wrote Mar 5, 2011 at 12:53 AM

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

wrote Feb 13, 2013 at 1:39 AM