Beispiel #1
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiCompositePrimaryKeyModelMapper();
            var model  = new ApiCompositePrimaryKeyResponseModel();

            model.SetProperties(1, 1);
            ApiCompositePrimaryKeyRequestModel response = mapper.MapResponseToRequest(model);

            response.Id2.Should().Be(1);
        }
Beispiel #2
0
        public void CreatePatch()
        {
            var mapper = new ApiCompositePrimaryKeyModelMapper();
            var model  = new ApiCompositePrimaryKeyRequestModel();

            model.SetProperties(1);

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

            patch.ApplyTo(response);
            response.Id2.Should().Be(1);
        }
        public async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

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

            ApiCompositePrimaryKeyResponseModel model = await client.CompositePrimaryKeyGetAsync(1);

            ApiCompositePrimaryKeyModelMapper mapper = new ApiCompositePrimaryKeyModelMapper();

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

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