示例#1
0
        public async void TestDelete()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());

            var createModel = new ApiSaleRequestModel();

            createModel.SetProperties(2m, "B", "B", 1, 1, "B");
            CreateResponse <ApiSaleResponseModel> createResult = await client.SaleCreateAsync(createModel);

            createResult.Success.Should().BeTrue();

            ApiSaleResponseModel getResponse = await client.SaleGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.SaleDeleteAsync(2);

            deleteResult.Success.Should().BeTrue();

            ApiSaleResponseModel verifyResponse = await client.SaleGetAsync(2);

            verifyResponse.Should().BeNull();
        }
示例#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());
            ApiSaleResponseModel response = await client.SaleGetAsync(1);

            response.Should().NotBeNull();
        }
示例#3
0
        public async void Get_null_record()
        {
            var mock = new ServiceMockFacade <ISaleRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <Sale>(null));
            var service = new SaleService(mock.LoggerMock.Object,
                                          mock.RepositoryMock.Object,
                                          mock.ModelValidatorMockFactory.SaleModelValidatorMock.Object,
                                          mock.BOLMapperMockFactory.BOLSaleMapperMock,
                                          mock.DALMapperMockFactory.DALSaleMapperMock);

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

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
示例#4
0
        public async void TestGet()
        {
            ApiSaleResponseModel response = await this.Client.SaleGetAsync(1);

            response.Should().NotBeNull();
        }