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

            ApiPurchaseOrderHeaderModelMapper mapper = new ApiPurchaseOrderHeaderModelMapper();

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

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

            await this.Cleanup();
        }
Пример #2
0
        public async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

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

            ApiPurchaseOrderHeaderResponseModel model = await client.PurchaseOrderHeaderGetAsync(1);

            ApiPurchaseOrderHeaderModelMapper mapper = new ApiPurchaseOrderHeaderModelMapper();

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

            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();
        }
        public void MapResponseToRequest()
        {
            var mapper = new ApiPurchaseOrderHeaderModelMapper();
            var model  = new ApiPurchaseOrderHeaderResponseModel();

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

            response.EmployeeID.Should().Be(1);
            response.Freight.Should().Be(1m);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.OrderDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.RevisionNumber.Should().Be(1);
            response.ShipDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.ShipMethodID.Should().Be(1);
            response.Status.Should().Be(1);
            response.SubTotal.Should().Be(1m);
            response.TaxAmt.Should().Be(1m);
            response.TotalDue.Should().Be(1m);
            response.VendorID.Should().Be(1);
        }
        public void CreatePatch()
        {
            var mapper = new ApiPurchaseOrderHeaderModelMapper();
            var model  = new ApiPurchaseOrderHeaderRequestModel();

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

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

            patch.ApplyTo(response);
            response.EmployeeID.Should().Be(1);
            response.Freight.Should().Be(1m);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.OrderDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.RevisionNumber.Should().Be(1);
            response.ShipDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.ShipMethodID.Should().Be(1);
            response.Status.Should().Be(1);
            response.SubTotal.Should().Be(1m);
            response.TaxAmt.Should().Be(1m);
            response.TotalDue.Should().Be(1m);
            response.VendorID.Should().Be(1);
        }