Esempio n. 1
0
        public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiProductVendorModelMapper mapper = new ApiProductVendorModelMapper();

            UpdateResponse <ApiProductVendorResponseModel> updateResponse = await this.Client.ProductVendorUpdateAsync(model.ProductID, 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());

            ApiProductVendorResponseModel model = await client.ProductVendorGetAsync(1);

            ApiProductVendorModelMapper mapper = new ApiProductVendorModelMapper();

            UpdateResponse <ApiProductVendorResponseModel> updateResponse = await client.ProductVendorUpdateAsync(model.ProductID, mapper.MapResponseToRequest(model));

            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();
        }
Esempio n. 3
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiProductVendorModelMapper();
            var model  = new ApiProductVendorResponseModel();

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

            response.AverageLeadTime.Should().Be(1);
            response.BusinessEntityID.Should().Be(1);
            response.LastReceiptCost.Should().Be(1m);
            response.LastReceiptDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.MaxOrderQty.Should().Be(1);
            response.MinOrderQty.Should().Be(1);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.OnOrderQty.Should().Be(1);
            response.StandardPrice.Should().Be(1m);
            response.UnitMeasureCode.Should().Be("A");
        }
Esempio n. 4
0
        public void CreatePatch()
        {
            var mapper = new ApiProductVendorModelMapper();
            var model  = new ApiProductVendorRequestModel();

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

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

            patch.ApplyTo(response);
            response.AverageLeadTime.Should().Be(1);
            response.BusinessEntityID.Should().Be(1);
            response.LastReceiptCost.Should().Be(1m);
            response.LastReceiptDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.MaxOrderQty.Should().Be(1);
            response.MinOrderQty.Should().Be(1);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.OnOrderQty.Should().Be(1);
            response.StandardPrice.Should().Be(1m);
            response.UnitMeasureCode.Should().Be("A");
        }