コード例 #1
0
        public async void Get()
        {
            var mock   = new ServiceMockFacade <ISalesPersonRepository>();
            var record = new SalesPerson();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(record));
            var service = new SalesPersonService(mock.LoggerMock.Object,
                                                 mock.RepositoryMock.Object,
                                                 mock.ModelValidatorMockFactory.SalesPersonModelValidatorMock.Object,
                                                 mock.BOLMapperMockFactory.BOLSalesPersonMapperMock,
                                                 mock.DALMapperMockFactory.DALSalesPersonMapperMock,
                                                 mock.BOLMapperMockFactory.BOLSalesOrderHeaderMapperMock,
                                                 mock.DALMapperMockFactory.DALSalesOrderHeaderMapperMock,
                                                 mock.BOLMapperMockFactory.BOLSalesPersonQuotaHistoryMapperMock,
                                                 mock.DALMapperMockFactory.DALSalesPersonQuotaHistoryMapperMock,
                                                 mock.BOLMapperMockFactory.BOLSalesTerritoryHistoryMapperMock,
                                                 mock.DALMapperMockFactory.DALSalesTerritoryHistoryMapperMock,
                                                 mock.BOLMapperMockFactory.BOLStoreMapperMock,
                                                 mock.DALMapperMockFactory.DALStoreMapperMock);

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

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

            var client = new ApiClient(testServer.CreateClient());
            ApiSalesPersonResponseModel response = await client.SalesPersonGetAsync(1);

            response.Should().NotBeNull();
        }
コード例 #3
0
        public async void TestGet()
        {
            ApiSalesPersonResponseModel response = await this.Client.SalesPersonGetAsync(1);

            response.Should().NotBeNull();
        }