Пример #1
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiSchemaBPersonModelMapper();
            var model  = new ApiSchemaBPersonResponseModel();

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

            response.Name.Should().Be("A");
        }
Пример #2
0
        public void CreatePatch()
        {
            var mapper = new ApiSchemaBPersonModelMapper();
            var model  = new ApiSchemaBPersonRequestModel();

            model.SetProperties("A");

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

            patch.ApplyTo(response);
            response.Name.Should().Be("A");
        }
Пример #3
0
        public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiSchemaBPersonModelMapper mapper = new ApiSchemaBPersonModelMapper();

            UpdateResponse <ApiSchemaBPersonResponseModel> updateResponse = await this.Client.SchemaBPersonUpdateAsync(model.Id, 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());

            ApiSchemaBPersonResponseModel model = await client.SchemaBPersonGetAsync(1);

            ApiSchemaBPersonModelMapper mapper = new ApiSchemaBPersonModelMapper();

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

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