dimanche 29 novembre 2015

How do you use ShouldThrow

I feel like it should be

Should.Throw<ArgumentNullException>(module.Execute(badArgument));

But when I try that there's no Throw method on the Should class or namespace.

There is however a couple methods, but when I call ShouldThrow

Should.ActionAssertionExtensions
    .ShouldThrow<ArgumentNullException>(() => module.Execute(badArgument));

it says it is an ambiguous call because there are two ShouldThrow method signatures

void ShouldThrow<TException>(this Should.Core.Assertions.Assert.ThrowsDelegate)    
void ShouldThrow<TException>(this System.Action)

Aucun commentaire:

Enregistrer un commentaire