Пример #1
0
        public void Update_CorrectInput_ReturnIdOfUpdatedDisease()
        {
            // Arrange
            TestData testData = new TestData();
            int      expectedUpdatedDiseaseId = testData.disease.DiseaseId;
            var      mockDataProvider         = new Mock <IDataAccessManager>();

            mockDataProvider.Setup(mock => mock.GetDisease(testData.disease.DiseaseId)).Returns(testData.disease);
            mockDataProvider.Setup(mock => mock.GetDiseaseCategories()).Returns(testData.Categories);
            mockDataProvider.Setup(mock => mock.GetDiseasesInCategory(It.IsAny <int>())).Returns(testData.Diseases);
            mockDataProvider.Setup(mock => mock.UpdateDisease(expectedUpdatedDiseaseId, testData.disease)).
            Returns(expectedUpdatedDiseaseId);
            var service = new DiseaseManager(mockDataProvider.Object);

            // Act
            int actualUpdatedDiseaseId = service.Update(expectedUpdatedDiseaseId, testData.disease);

            // Assert
            Assert.AreEqual(expectedUpdatedDiseaseId, actualUpdatedDiseaseId);
        }