NUnit - Constraints
Links
Exception
I checked that an exception was thrown like this (not sure it is the best way though):
Exception result = null;
try
{
fileManager.doSomeStuff();
}
catch (Exception e)
{
result = e;
}
Assert.That(result, Is.TypeOf(typeof(MySampleException)));
Sample
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
[Test]
public void testIsNew()
{
Assert.That(idx1.isNew(), Is.True);
}
[Test]
public void testIsNewNot()
{
Assert.That(idx2.isNew(), Is.False);
}
Issues
Is
The type or namespace name 'Is' could not be found (are you missing a using directive or an assembly reference?)
Add using NUnit.Framework.SyntaxHelpers
to your source file…