public void TestCheckUID() { var mock = new Mock <IScanDataService>(); mock.Setup(p => p.CheckUserScanData("5")).Returns(new Spec_Project.Models.ResponseModel { Data = "done" }); ScanDataController home = new ScanDataController(mock.Object); var result = (OkObjectResult)home.CheckUserScanData("5"); var actualResponse = Assert.IsType <ResponseModel>(result.Value); Assert.Equal("done", actualResponse.Data); }
public void TestDeleteScanData() { List <string> x = new List <string>() { "5", "6", "7" }; var mock = new Mock <IScanDataService>(); mock.Setup(p => p.DeleteArrScanData(x)).Returns(new Spec_Project.Models.ResponseModel { Data = "done" }); ScanDataController home = new ScanDataController(mock.Object); var result = (OkObjectResult)home.DeleteArrScanData(x); //result.Value // Assert var actualResponse = Assert.IsType <ResponseModel>(result.Value); Assert.Equal("done", actualResponse.Data); }
public void TestEditScandata() { var newadd = GetAddScandata(); // Arrange var mockRepo = new Mock <IScanDataService>(); mockRepo.Setup(p => p.EditScandata(newadd)).Returns(new Spec_Project.Models.ResponseModel { Data = "done" }); var controller = new ScanDataController(mockRepo.Object); // Act var result = (OkObjectResult)controller.EditScandata(newadd); //result.Value // Assert var actualResponse = Assert.IsType <ResponseModel>(result.Value); Assert.Equal("done", actualResponse.Data); mockRepo.Verify(); }