public void MapResponseToRequest() { var mapper = new ApiPenModelMapper(); var model = new ApiPenResponseModel(); model.SetProperties(1, "A"); ApiPenRequestModel response = mapper.MapResponseToRequest(model); response.Name.Should().Be("A"); }
public void MapClientRequestToResponse() { var mapper = new ApiPenModelMapper(); var model = new ApiPenClientRequestModel(); model.SetProperties("A"); ApiPenClientResponseModel response = mapper.MapClientRequestToResponse(1, model); response.Should().NotBeNull(); response.Name.Should().Be("A"); }
public async void TestUpdate() { var model = await this.CreateRecord(); ApiPenModelMapper mapper = new ApiPenModelMapper(); UpdateResponse <ApiPenResponseModel> updateResponse = await this.Client.PenUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void CreatePatch() { var mapper = new ApiPenModelMapper(); var model = new ApiPenRequestModel(); model.SetProperties("A"); JsonPatchDocument <ApiPenRequestModel> patch = mapper.CreatePatch(model); var response = new ApiPenRequestModel(); 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()); ApiPenResponseModel model = await client.PenGetAsync(1); ApiPenModelMapper mapper = new ApiPenModelMapper(); UpdateResponse <ApiPenResponseModel> updateResponse = await client.PenUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }