public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiProductModelModelMapper mapper = new ApiProductModelModelMapper();

            UpdateResponse <ApiProductModelResponseModel> updateResponse = await this.Client.ProductModelUpdateAsync(model.ProductModelID, mapper.MapResponseToRequest(model));

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

            await this.Cleanup();
        }
Exemplo n.º 2
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiProductModelModelMapper();
            var model  = new ApiProductModelResponseModel();

            model.SetProperties(1, "A", "A", DateTime.Parse("1/1/1987 12:00:00 AM"), "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            ApiProductModelRequestModel response = mapper.MapResponseToRequest(model);

            response.CatalogDescription.Should().Be("A");
            response.Instruction.Should().Be("A");
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Name.Should().Be("A");
            response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
        }
Exemplo n.º 3
0
        public void CreatePatch()
        {
            var mapper = new ApiProductModelModelMapper();
            var model  = new ApiProductModelRequestModel();

            model.SetProperties("A", "A", DateTime.Parse("1/1/1987 12:00:00 AM"), "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));

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

            patch.ApplyTo(response);
            response.CatalogDescription.Should().Be("A");
            response.Instruction.Should().Be("A");
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Name.Should().Be("A");
            response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
        }
        public async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

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

            ApiProductModelResponseModel model = await client.ProductModelGetAsync(1);

            ApiProductModelModelMapper mapper = new ApiProductModelModelMapper();

            UpdateResponse <ApiProductModelResponseModel> updateResponse = await client.ProductModelUpdateAsync(model.ProductModelID, mapper.MapResponseToRequest(model));

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