Ejemplo n.º 1
0
        public void Delete_InCorrectInputDiseaseId_ExceptionExpected()
        {
            // Arrange
            TestData testData         = new TestData();
            var      mockDataProvider = new Mock <IDataAccessManager>();

            mockDataProvider.Setup(mock => mock.DeleteDisease(testData.disease.DiseaseId)).
            Returns(testData.disease.DiseaseId);
            var service = new DiseaseManager(mockDataProvider.Object);

            // Act
            int deletedDiseaseId = service.Delete(testData.disease.DiseaseId);

            // Assert
            Assert.AreEqual(testData.disease.DiseaseId, deletedDiseaseId);
        }
Ejemplo n.º 2
0
        public void Delete_CorrectInputDiseaseId_ReturnIdOfDeletedDisease()
        {
            // Arrange
            TestData testData         = new TestData();
            var      mockDataProvider = new Mock <IDataAccessManager>();

            mockDataProvider.Setup(mock => mock.GetDisease(It.IsAny <int>())).Returns(testData.disease);
            mockDataProvider.Setup(mock => mock.DeleteDisease(testData.disease.DiseaseId)).
            Returns(testData.disease.DiseaseId);
            var service = new DiseaseManager(mockDataProvider.Object);

            // Act
            int deletedDiseaseId = service.Delete(testData.disease.DiseaseId);

            // Assert
            Assert.AreEqual(testData.disease.DiseaseId, deletedDiseaseId);
        }