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

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

            response.Name.Should().Be("A");
        }
コード例 #2
0
        public void MapClientRequestToResponse()
        {
            var mapper = new ApiCountryModelMapper();
            var model  = new ApiCountryClientRequestModel();

            model.SetProperties("A");
            ApiCountryClientResponseModel response = mapper.MapClientRequestToResponse(1, model);

            response.Should().NotBeNull();
            response.Name.Should().Be("A");
        }
コード例 #3
0
        public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiCountryModelMapper mapper = new ApiCountryModelMapper();

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

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

            await this.Cleanup();
        }
コード例 #4
0
        public void CreatePatch()
        {
            var mapper = new ApiCountryModelMapper();
            var model  = new ApiCountryRequestModel();

            model.SetProperties("A");

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

            patch.ApplyTo(response);
            response.Name.Should().Be("A");
        }
コード例 #5
0
        public async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

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

            ApiCountryResponseModel model = await client.CountryGetAsync(1);

            ApiCountryModelMapper mapper = new ApiCountryModelMapper();

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

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