public void Add_InorrectInputDiseaseName_ExceptionExpected() { // Arrange TestData testData = new TestData(); testData.disease.Name = testData.Diseases[0].Name; var mockDataProvider = new Mock <IDataAccessManager>(); mockDataProvider.Setup(mock => mock.GetDiseaseCategories()).Returns(testData.Categories); mockDataProvider.Setup(mock => mock.GetDiseasesInCategory(It.IsAny <int>())).Returns(testData.Diseases); mockDataProvider.Setup(mock => mock.AddDisease(testData.disease)).Returns(testData.disease.DiseaseId); var service = new DiseaseManager(mockDataProvider.Object); // Act int addedDiseaseId = service.Add(testData.disease); }
public void Add_CorrectInputDisease_ReturnIdOfAddedDisease() { // Arrange TestData testData = new TestData(); var mockDataProvider = new Mock <IDataAccessManager>(); mockDataProvider.Setup(mock => mock.GetDiseaseCategories()).Returns(testData.Categories); mockDataProvider.Setup(mock => mock.GetDiseasesInCategory(It.IsAny <int>())).Returns(testData.Diseases); mockDataProvider.Setup(mock => mock.AddDisease(testData.disease)).Returns(testData.disease.DiseaseId); var service = new DiseaseManager(mockDataProvider.Object); // Act int addedDiseaseId = service.Add(testData.disease); // Assert Assert.AreEqual(testData.disease.DiseaseId, addedDiseaseId); }