public void MapResponseToRequest() { var mapper = new ApiLinkStatusModelMapper(); var model = new ApiLinkStatusResponseModel(); model.SetProperties(1, "A"); ApiLinkStatusRequestModel response = mapper.MapResponseToRequest(model); response.Name.Should().Be("A"); }
public void MapClientRequestToResponse() { var mapper = new ApiLinkStatusModelMapper(); var model = new ApiLinkStatusClientRequestModel(); model.SetProperties("A"); ApiLinkStatusClientResponseModel response = mapper.MapClientRequestToResponse(1, model); response.Should().NotBeNull(); response.Name.Should().Be("A"); }
public async void TestUpdate() { var model = await this.CreateRecord(); ApiLinkStatusModelMapper mapper = new ApiLinkStatusModelMapper(); UpdateResponse <ApiLinkStatusResponseModel> updateResponse = await this.Client.LinkStatusUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void CreatePatch() { var mapper = new ApiLinkStatusModelMapper(); var model = new ApiLinkStatusRequestModel(); model.SetProperties("A"); JsonPatchDocument <ApiLinkStatusRequestModel> patch = mapper.CreatePatch(model); var response = new ApiLinkStatusRequestModel(); 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()); ApiLinkStatusResponseModel model = await client.LinkStatusGetAsync(1); ApiLinkStatusModelMapper mapper = new ApiLinkStatusModelMapper(); UpdateResponse <ApiLinkStatusResponseModel> updateResponse = await client.LinkStatusUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }