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"); }
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"); }
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(); }