Exemplo n.º 1
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiVoteTypeModelMapper();
            var model  = new ApiVoteTypeResponseModel();

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

            response.Name.Should().Be("A");
        }
        public void MapClientRequestToResponse()
        {
            var mapper = new ApiVoteTypeModelMapper();
            var model  = new ApiVoteTypeClientRequestModel();

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

            response.Should().NotBeNull();
            response.Name.Should().Be("A");
        }
Exemplo n.º 3
0
        public void CreatePatch()
        {
            var mapper = new ApiVoteTypeModelMapper();
            var model  = new ApiVoteTypeRequestModel();

            model.SetProperties("A");

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

            patch.ApplyTo(response);
            response.Name.Should().Be("A");
        }
Exemplo n.º 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());

            ApiVoteTypeResponseModel model = await client.VoteTypeGetAsync(1);

            ApiVoteTypeModelMapper mapper = new ApiVoteTypeModelMapper();

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

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