I am new for unit testing. I have created test method in unit testing project. In that test method I called API method for testing .
API method connected with database. When i run unit test project getting "No connection found" error.
Test method always getting failure.
Please suggest you solution. Please find my code
TestCase:
[TestMethod]
public void ValidateCheckInCheckOut_Test2()
{
int task_id = 0;
var userToken = "dsdjs2";
Object response = new Object ();
var actual = class.GetValidationResponse(task_id, userToken); Assert.AreNotEqual(actual.GetType(), response.GetType());
}
API method:
public void GetValidationResponse(int taskid , string userToken)
{
using(var context = new DbContext())
{
Some logic......
}
}