chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes

Hello, 

I have simple unit test as follows:

[Test]
public void Delete_ShouldThrowNotFoundException()
{
Isolate.WhenCalled(() => Status.Load(0)).WillReturn(new Status());
 
var target = new StatusController();
 
Assert.Throws<NotFoundException>(() => target.Delete(1), "The Status is deleted.");
}
 
 
When I run the test via Typemock Test Navigator window, test fails with:
 
System.NullReferenceException : Object reference not set to an instance of an object.
 
   at NUnit.Framework.Internal.TestExecutionContext.IsolatedContext..ctor()
   at NUnit.Framework.Assert.Throws(IResolveConstraint expression, TestDelegate code, String message, Object[] args)
   at NUnit.Framework.Assert.Throws(Type expectedExceptionType, TestDelegate code, String message, Object[] args)
   at NUnit.Framework.Assert.Throws[TActual](TestDelegate code, String message, Object[] args)
   at ...StatusControllerTest.Delete_ShouldThrowNotFoundException() in ...StatusControllerTest.cs:line 62
 
 
But when I run it via MS Test Explorer, it passes. 
 
How can I integrate Test Navigator with nUnit, so they will rok well together?
 
My configuration is:
VS 2017 Enterprise
nUnit 3.7.1.0
Typemock 8.6.0.10
 
Thanks.
asked by Ctvt (2.7k points)
edited by Ctvt

Please log in or register to answer this question.

...