Exemple #1
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiBillOfMaterialModelMapper();
            var model  = new ApiBillOfMaterialResponseModel();

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

            response.BOMLevel.Should().Be(1);
            response.ComponentID.Should().Be(1);
            response.EndDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.PerAssemblyQty.Should().Be(1);
            response.ProductAssemblyID.Should().Be(1);
            response.StartDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.UnitMeasureCode.Should().Be("A");
        }
        public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiBillOfMaterialModelMapper mapper = new ApiBillOfMaterialModelMapper();

            UpdateResponse <ApiBillOfMaterialResponseModel> updateResponse = await this.Client.BillOfMaterialUpdateAsync(model.BillOfMaterialsID, 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());

            ApiBillOfMaterialResponseModel model = await client.BillOfMaterialGetAsync(1);

            ApiBillOfMaterialModelMapper mapper = new ApiBillOfMaterialModelMapper();

            UpdateResponse <ApiBillOfMaterialResponseModel> updateResponse = await client.BillOfMaterialUpdateAsync(model.BillOfMaterialsID, mapper.MapResponseToRequest(model));

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