예제 #1
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiSchemaAPersonModelMapper();
            var model  = new ApiSchemaAPersonResponseModel();

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

            response.Name.Should().Be("A");
        }
        public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiSchemaAPersonModelMapper mapper = new ApiSchemaAPersonModelMapper();

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

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

            await this.Cleanup();
        }
예제 #3
0
        public void CreatePatch()
        {
            var mapper = new ApiSchemaAPersonModelMapper();
            var model  = new ApiSchemaAPersonRequestModel();

            model.SetProperties("A");

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

            patch.ApplyTo(response);
            response.Name.Should().Be("A");
        }
예제 #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());

            ApiSchemaAPersonResponseModel model = await client.SchemaAPersonGetAsync(1);

            ApiSchemaAPersonModelMapper mapper = new ApiSchemaAPersonModelMapper();

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

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