Ejemplo n.º 1
0
        public async void Get_ShouldReturnNullBecauseRecordNotFound()
        {
            var mock = new ServiceMockFacade <IFileTypeService, IFileTypeRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <FileType>(null));
            var service = new FileTypeService(mock.LoggerMock.Object,
                                              mock.MediatorMock.Object,
                                              mock.RepositoryMock.Object,
                                              mock.ModelValidatorMockFactory.FileTypeModelValidatorMock.Object,
                                              mock.DALMapperMockFactory.DALFileTypeMapperMock,
                                              mock.DALMapperMockFactory.DALFileMapperMock);

            ApiFileTypeServerResponseModel response = await service.Get(default(int));

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
Ejemplo n.º 2
0
        public async void Get()
        {
            var mock   = new ServiceMockFacade <IFileTypeRepository>();
            var record = new FileType();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(record));
            var service = new FileTypeService(mock.LoggerMock.Object,
                                              mock.RepositoryMock.Object,
                                              mock.ModelValidatorMockFactory.FileTypeModelValidatorMock.Object,
                                              mock.BOLMapperMockFactory.BOLFileTypeMapperMock,
                                              mock.DALMapperMockFactory.DALFileTypeMapperMock,
                                              mock.BOLMapperMockFactory.BOLFileMapperMock,
                                              mock.DALMapperMockFactory.DALFileMapperMock);

            ApiFileTypeResponseModel response = await service.Get(default(int));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }