예제 #1
0
        public async void Update()
        {
            var mock  = new ServiceMockFacade <ILessonStatusRepository>();
            var model = new ApiLessonStatusRequestModel();

            mock.RepositoryMock.Setup(x => x.Create(It.IsAny <LessonStatus>())).Returns(Task.FromResult(new LessonStatus()));
            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new LessonStatus()));
            var service = new LessonStatusService(mock.LoggerMock.Object,
                                                  mock.RepositoryMock.Object,
                                                  mock.ModelValidatorMockFactory.LessonStatusModelValidatorMock.Object,
                                                  mock.BOLMapperMockFactory.BOLLessonStatusMapperMock,
                                                  mock.DALMapperMockFactory.DALLessonStatusMapperMock,
                                                  mock.BOLMapperMockFactory.BOLLessonMapperMock,
                                                  mock.DALMapperMockFactory.DALLessonMapperMock);

            UpdateResponse <ApiLessonStatusResponseModel> response = await service.Update(default(int), model);

            response.Should().NotBeNull();
            mock.ModelValidatorMockFactory.LessonStatusModelValidatorMock.Verify(x => x.ValidateUpdateAsync(It.IsAny <int>(), It.IsAny <ApiLessonStatusRequestModel>()));
            mock.RepositoryMock.Verify(x => x.Update(It.IsAny <LessonStatus>()));
        }