コード例 #1
0
        public async void ByAccountNumber_Not_Exists()
        {
            var mock = new ServiceMockFacade <IVendorRepository>();

            mock.RepositoryMock.Setup(x => x.ByAccountNumber(It.IsAny <string>())).Returns(Task.FromResult <Vendor>(null));
            var service = new VendorService(mock.LoggerMock.Object,
                                            mock.RepositoryMock.Object,
                                            mock.ModelValidatorMockFactory.VendorModelValidatorMock.Object,
                                            mock.BOLMapperMockFactory.BOLVendorMapperMock,
                                            mock.DALMapperMockFactory.DALVendorMapperMock,
                                            mock.BOLMapperMockFactory.BOLProductVendorMapperMock,
                                            mock.DALMapperMockFactory.DALProductVendorMapperMock,
                                            mock.BOLMapperMockFactory.BOLPurchaseOrderHeaderMapperMock,
                                            mock.DALMapperMockFactory.DALPurchaseOrderHeaderMapperMock);

            ApiVendorResponseModel response = await service.ByAccountNumber(default(string));

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.ByAccountNumber(It.IsAny <string>()));
        }