public async void Get()
        {
            var mock   = new ServiceMockFacade <ISalesTerritoryRepository>();
            var record = new SalesTerritory();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(record));
            var service = new SalesTerritoryService(mock.LoggerMock.Object,
                                                    mock.RepositoryMock.Object,
                                                    mock.ModelValidatorMockFactory.SalesTerritoryModelValidatorMock.Object,
                                                    mock.BOLMapperMockFactory.BOLSalesTerritoryMapperMock,
                                                    mock.DALMapperMockFactory.DALSalesTerritoryMapperMock,
                                                    mock.BOLMapperMockFactory.BOLCustomerMapperMock,
                                                    mock.DALMapperMockFactory.DALCustomerMapperMock,
                                                    mock.BOLMapperMockFactory.BOLSalesOrderHeaderMapperMock,
                                                    mock.DALMapperMockFactory.DALSalesOrderHeaderMapperMock,
                                                    mock.BOLMapperMockFactory.BOLSalesPersonMapperMock,
                                                    mock.DALMapperMockFactory.DALSalesPersonMapperMock,
                                                    mock.BOLMapperMockFactory.BOLSalesTerritoryHistoryMapperMock,
                                                    mock.DALMapperMockFactory.DALSalesTerritoryHistoryMapperMock);

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

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
        public async void TestGet()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());
            ApiSalesTerritoryResponseModel response = await client.SalesTerritoryGetAsync(1);

            response.Should().NotBeNull();
        }
        public async void ByName_Not_Exists()
        {
            var mock = new ServiceMockFacade <ISalesTerritoryRepository>();

            mock.RepositoryMock.Setup(x => x.ByName(It.IsAny <string>())).Returns(Task.FromResult <SalesTerritory>(null));
            var service = new SalesTerritoryService(mock.LoggerMock.Object,
                                                    mock.RepositoryMock.Object,
                                                    mock.ModelValidatorMockFactory.SalesTerritoryModelValidatorMock.Object,
                                                    mock.BOLMapperMockFactory.BOLSalesTerritoryMapperMock,
                                                    mock.DALMapperMockFactory.DALSalesTerritoryMapperMock,
                                                    mock.BOLMapperMockFactory.BOLCustomerMapperMock,
                                                    mock.DALMapperMockFactory.DALCustomerMapperMock,
                                                    mock.BOLMapperMockFactory.BOLSalesOrderHeaderMapperMock,
                                                    mock.DALMapperMockFactory.DALSalesOrderHeaderMapperMock,
                                                    mock.BOLMapperMockFactory.BOLSalesPersonMapperMock,
                                                    mock.DALMapperMockFactory.DALSalesPersonMapperMock,
                                                    mock.BOLMapperMockFactory.BOLSalesTerritoryHistoryMapperMock,
                                                    mock.DALMapperMockFactory.DALSalesTerritoryHistoryMapperMock);

            ApiSalesTerritoryResponseModel response = await service.ByName(default(string));

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.ByName(It.IsAny <string>()));
        }
示例#4
0
        public async void TestGet()
        {
            ApiSalesTerritoryResponseModel response = await this.Client.SalesTerritoryGetAsync(1);

            response.Should().NotBeNull();
        }