Esempio n. 1
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiDestinationModelMapper();
            var model  = new ApiDestinationResponseModel();

            model.SetProperties(1, 1, "A", 1);
            ApiDestinationRequestModel response = mapper.MapResponseToRequest(model);

            response.CountryId.Should().Be(1);
            response.Name.Should().Be("A");
            response.Order.Should().Be(1);
        }
Esempio n. 2
0
        public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiDestinationModelMapper mapper = new ApiDestinationModelMapper();

            UpdateResponse <ApiDestinationResponseModel> updateResponse = await this.Client.DestinationUpdateAsync(model.Id, mapper.MapResponseToRequest(model));

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

            await this.Cleanup();
        }
Esempio n. 3
0
        public void CreatePatch()
        {
            var mapper = new ApiDestinationModelMapper();
            var model  = new ApiDestinationRequestModel();

            model.SetProperties(1, "A", 1);

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

            patch.ApplyTo(response);
            response.CountryId.Should().Be(1);
            response.Name.Should().Be("A");
            response.Order.Should().Be(1);
        }
Esempio n. 4
0
        public async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

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

            ApiDestinationResponseModel model = await client.DestinationGetAsync(1);

            ApiDestinationModelMapper mapper = new ApiDestinationModelMapper();

            UpdateResponse <ApiDestinationResponseModel> updateResponse = await client.DestinationUpdateAsync(model.Id, mapper.MapResponseToRequest(model));

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