コード例 #1
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiPersonRefModelMapper();
            var model  = new ApiPersonRefResponseModel();

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

            response.PersonAId.Should().Be(1);
            response.PersonBId.Should().Be(1);
        }
コード例 #2
0
        public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiPersonRefModelMapper mapper = new ApiPersonRefModelMapper();

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

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

            await this.Cleanup();
        }
コード例 #3
0
        public void CreatePatch()
        {
            var mapper = new ApiPersonRefModelMapper();
            var model  = new ApiPersonRefRequestModel();

            model.SetProperties(1, 1);

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

            patch.ApplyTo(response);
            response.PersonAId.Should().Be(1);
            response.PersonBId.Should().Be(1);
        }
コード例 #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());

            ApiPersonRefResponseModel model = await client.PersonRefGetAsync(1);

            ApiPersonRefModelMapper mapper = new ApiPersonRefModelMapper();

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

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