I suppose I could use the ExpectedException attribute as well ... but I still think Assert.Throws is more clear.
Dan Lash On Feb 6, 9:48 am, Dan Lash <[email protected]> wrote: > Is there a way to use Assert.Throws in VB.net? > > All of the overloads for it take an Action (delegate) or lambda. The > problem with VB is that lambda's > 1) can only have one expression > 2) must return a value > > So something as simple as: > Assert.Throws(Of NullReferenceException)(Function() Console.WriteLine > ("Doesn't Work In VB")) > > Gives this compile error: > Expression does not produce a value. > > I guess an acceptable work around is to do the try/catching myself and > Assert.Fail, but I like the syntax of Assert.Throws. > > Thanks, > > Dan Lash --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MbUnit.User" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/MbUnitUser?hl=en -~----------~----~----~----~------~----~------~--~---
