public void MapResponseToRequest() { var mapper = new ApiSelfReferenceModelMapper(); var model = new ApiSelfReferenceResponseModel(); model.SetProperties(1, 1, 1); ApiSelfReferenceRequestModel response = mapper.MapResponseToRequest(model); response.SelfReferenceId.Should().Be(1); response.SelfReferenceId2.Should().Be(1); }
public void MapClientRequestToResponse() { var mapper = new ApiSelfReferenceModelMapper(); var model = new ApiSelfReferenceClientRequestModel(); model.SetProperties(1, 1); ApiSelfReferenceClientResponseModel response = mapper.MapClientRequestToResponse(1, model); response.Should().NotBeNull(); response.SelfReferenceId.Should().Be(1); response.SelfReferenceId2.Should().Be(1); }
public async void TestUpdate() { var model = await this.CreateRecord(); ApiSelfReferenceModelMapper mapper = new ApiSelfReferenceModelMapper(); UpdateResponse <ApiSelfReferenceResponseModel> updateResponse = await this.Client.SelfReferenceUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void CreatePatch() { var mapper = new ApiSelfReferenceModelMapper(); var model = new ApiSelfReferenceRequestModel(); model.SetProperties(1, 1); JsonPatchDocument <ApiSelfReferenceRequestModel> patch = mapper.CreatePatch(model); var response = new ApiSelfReferenceRequestModel(); patch.ApplyTo(response); response.SelfReferenceId.Should().Be(1); response.SelfReferenceId2.Should().Be(1); }
public async void TestUpdate() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); ApiSelfReferenceResponseModel model = await client.SelfReferenceGetAsync(1); ApiSelfReferenceModelMapper mapper = new ApiSelfReferenceModelMapper(); UpdateResponse <ApiSelfReferenceResponseModel> updateResponse = await client.SelfReferenceUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }