Пример #1
0
        public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiPurchaseOrderDetailModelMapper mapper = new ApiPurchaseOrderDetailModelMapper();

            UpdateResponse <ApiPurchaseOrderDetailResponseModel> updateResponse = await this.Client.PurchaseOrderDetailUpdateAsync(model.PurchaseOrderID, mapper.MapResponseToRequest(model));

            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();

            await this.Cleanup();
        }
        public async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

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

            ApiPurchaseOrderDetailResponseModel model = await client.PurchaseOrderDetailGetAsync(1);

            ApiPurchaseOrderDetailModelMapper mapper = new ApiPurchaseOrderDetailModelMapper();

            UpdateResponse <ApiPurchaseOrderDetailResponseModel> updateResponse = await client.PurchaseOrderDetailUpdateAsync(model.PurchaseOrderID, mapper.MapResponseToRequest(model));

            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();
        }
Пример #3
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiPurchaseOrderDetailModelMapper();
            var model  = new ApiPurchaseOrderDetailResponseModel();

            model.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1m, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, 1, 1, 1, 1, 1m);
            ApiPurchaseOrderDetailRequestModel response = mapper.MapResponseToRequest(model);

            response.DueDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.LineTotal.Should().Be(1m);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.OrderQty.Should().Be(1);
            response.ProductID.Should().Be(1);
            response.PurchaseOrderDetailID.Should().Be(1);
            response.ReceivedQty.Should().Be(1);
            response.RejectedQty.Should().Be(1);
            response.StockedQty.Should().Be(1);
            response.UnitPrice.Should().Be(1m);
        }
Пример #4
0
        public void CreatePatch()
        {
            var mapper = new ApiPurchaseOrderDetailModelMapper();
            var model  = new ApiPurchaseOrderDetailRequestModel();

            model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), 1m, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, 1, 1, 1, 1, 1m);

            JsonPatchDocument <ApiPurchaseOrderDetailRequestModel> patch = mapper.CreatePatch(model);
            var response = new ApiPurchaseOrderDetailRequestModel();

            patch.ApplyTo(response);
            response.DueDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.LineTotal.Should().Be(1m);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.OrderQty.Should().Be(1);
            response.ProductID.Should().Be(1);
            response.PurchaseOrderDetailID.Should().Be(1);
            response.ReceivedQty.Should().Be(1);
            response.RejectedQty.Should().Be(1);
            response.StockedQty.Should().Be(1);
            response.UnitPrice.Should().Be(1m);
        }