2013-06-04 9 views

risposta

5

Forse stavi cercando:

Assert.IsType<TypeNotRegisteredException>(exception); 

Fammi sapere se questo è vicino a quello che stai cercando.

2

Sto pensando che stai chiedendo qual è l'equivalente del InstanceOfType assert piuttosto che l'equivalente di Assert.That. Quest'ultima è solo una sintassi migliore che ti consente di leggere i tuoi asser come l'inglese.

L'equivalente di InstanceOfType assert in xUnit è IsType:

Assert.IsType<TypeNotRegisteredException>(exception); 

Nota che il NUnit equivalente è, infatti:

Assert.IsInstanceOf<TypeNotRegisteredException>(exception); 

(il più vecchio IsInstanceOfType assert è deprecato - http://www.nunit.org/index.php?p=typeAsserts&r=2.5.1)

Problemi correlati