public void MapResponseToRequest() { var mapper = new ApiTicketStatuModelMapper(); var model = new ApiTicketStatuResponseModel(); model.SetProperties(1, "A"); ApiTicketStatuRequestModel response = mapper.MapResponseToRequest(model); response.Name.Should().Be("A"); }
public void CreatePatch() { var mapper = new ApiTicketStatuModelMapper(); var model = new ApiTicketStatuRequestModel(); model.SetProperties("A"); JsonPatchDocument <ApiTicketStatuRequestModel> patch = mapper.CreatePatch(model); var response = new ApiTicketStatuRequestModel(); 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()); ApiTicketStatuResponseModel model = await client.TicketStatuGetAsync(1); ApiTicketStatuModelMapper mapper = new ApiTicketStatuModelMapper(); UpdateResponse <ApiTicketStatuResponseModel> updateResponse = await client.TicketStatuUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }