I am exploring CodeCamper project by JohnPapa on github https://github.com/johnpapa/CodeCamper. This is a ASP.Net SPA application and I am also working on similar project.
I interested to write some UnitTests for WebAPI controller. Controller contractor requires UnitofWork instanse and UnitofWork is initiate in Application_Start method.
When I run my UnitTest project UnitofWork object is null. How I can initiate UnitofWork from UnitTest project so that I can run my test methods. I hope make myself clear.
Here is a sample UnitTest method for following controller.
UserControllerTest.cs
[TestClass]
public class UserControllerTest : ApiBaseController
{
[TestMethod]
public void GetRoomsTest()
{
var controller = new LookupsController(Uow);
var result = controller. GetRooms().Any();
Assert.IsTrue(result);
}
}
Again why Uow is null? What should I do, so that I can write unit test methods for this type of project/architecture.
For more detail about code you can check github repo.https://github.com/johnpapa/CodeCamper