We have some unit tests that we are trying to convert from MSTest to nUnit. When we run the unit tests (using Resharper) in MSTest they run without any exceptions, but when we try to run it in NUnit they fail.
The code we are running is:
var httpResponse =
new
HttpResponse(
null
);
var httpRequest =
new
HttpRequest(
string
.Empty,
"http://somewhere.com/"
,
null
);
var currentContext = Mock.Create<HttpContext>(() =>
new
HttpContext(httpRequest, httpResponse));
Mock.Arrange(() => HttpContext.Current).Returns(currentContext);
Assert.IsNotNull(HttpContext.Current);
Assert.IsNotNull(HttpContext.Current.Request);<br>
Using nUnit it fails on the first assertion.
Any ideas why this is happening?
Craig
5 Answers, 1 is accepted
Thanks again for reporting the issue. I ran the test with R# test runner and it did failed. However, it passes while running with TestDriven.Net. It could be that R# has some compatibility issue with JustMock where the profiling variables are not initialized properly when running with it. But I am logging this into our system to further investigate. In the meantime, you can use TestDriven.Net RTM that works perfectly with JM along with NUnit.
Sorry for the inconvenience.
http://www.telerik.com/support/pits.aspx#/public/justmock/9007
Kind Regards,
Mehfuz
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Craig
Unfortunately, there are still some capability issues with R# test runner and JustMock. In the meantime, I would request you to use TestDriven.NET for the purpose.
Kind Regards,
Mehfuz
the Telerik team
Unfortunately TestDriven.NET is not an option as this requires purchasing licenses. Do you have any timeframe for when you can investigate the issue?
Craig
Thanks again for the reply.
However, you can also try considering the personal version of TDD.NET which is free and by any chance if you have Telerik subscription then you can consider trying JustCode that has a test runner and works nicely with JustMock.
Mehfuz
the Telerik team