예제 #1
0
        public async void ExecuteWithNoExistingFindingsStatesTest()
        {
            //Arrange
            var findingsS = new FindingsState("code1", "name1", "colour1", true, 1);
            var mockFindingsStatesCriteriaRepository = new Mock <IFindingStateRepository>();

            mockFindingsStatesCriteriaRepository.Setup(e => e.Get(It.IsNotNull <string>(), It.IsNotNull <string>(), It.IsNotNull <string>())).Returns(findingsS);
            mockFindingsStatesCriteriaRepository.Setup(e => e.Update(It.IsNotNull <FindingsState>())).Returns(findingsS);

            var useCase = new UpdateFindingsStatesUseCase(mockFindingsStatesCriteriaRepository.Object);

            //Act

            //Assert
            Assert.Throws <EntityNotFoundException>(() => useCase.Execute(1, "code1", "name1", "colour1", true));
        }
예제 #2
0
        public async void ExecuteWithExistingFindingsStatesTest()
        {
            //Arrange
            var findingsS = new FindingsState("code1", "name1", "colour1", true, 1);
            var mockFindingsStatesCriteriaRepository = new Mock <IFindingStateRepository>();

            mockFindingsStatesCriteriaRepository.Setup(e => e.Get(It.IsNotNull <int>())).Returns(findingsS);
            mockFindingsStatesCriteriaRepository.Setup(e => e.Update(It.IsNotNull <FindingsState>())).Returns(findingsS);

            var useCase = new UpdateFindingsStatesUseCase(mockFindingsStatesCriteriaRepository.Object);
            //Act

            var res = useCase.Execute(1, "code1", "name1", "colour1", true);

            //Assert
            Assert.IsType <FindingsStatesOutput>(res);
        }