public void Employee_CheckUserCredential_Should_Return_NotFoundException_If_UserCredtialsExistsInDatabase() { var mockData = new UserDetail(); mockData = null; var moq = new Mock <IRepository>(); moq.Setup(x => x.CheckUserCredetial(It.IsAny <string>(), It.IsAny <string>())).Returns(mockData); var controller = new EmployeeController(moq.Object); var result = controller.CheckUserCredential(string.Empty, string.Empty); Assert.IsInstanceOfType(result, typeof(NotFoundResult)); }
public void Employee_CheckUserCredential_Should_Return_OkResult_If_UserCredtialsExistsInDatabase() { var mockData = new UserDetail() { Username = "******", Password = "******" }; var moq = new Mock <IRepository>(); moq.Setup(x => x.CheckUserCredetial(It.IsAny <string>(), It.IsAny <string>())).Returns(mockData); var controller = new EmployeeController(moq.Object); var result = controller.CheckUserCredential("imran", "12345") as OkNegotiatedContentResult <UserDetail>; Assert.IsNotNull(result.Content); }