public async void TestUpdate() { var model = await this.CreateRecord(); ApiClientModelMapper mapper = new ApiClientModelMapper(); UpdateResponse <ApiClientResponseModel> updateResponse = await this.Client.ClientUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void MapResponseToRequest() { var mapper = new ApiClientModelMapper(); var model = new ApiClientResponseModel(); model.SetProperties(1, "A", "A", "A", "A", "A"); ApiClientRequestModel response = mapper.MapResponseToRequest(model); response.Email.Should().Be("A"); response.FirstName.Should().Be("A"); response.LastName.Should().Be("A"); response.Note.Should().Be("A"); response.Phone.Should().Be("A"); }
public void CreatePatch() { var mapper = new ApiClientModelMapper(); var model = new ApiClientRequestModel(); model.SetProperties("A", "A", "A", "A", "A"); JsonPatchDocument <ApiClientRequestModel> patch = mapper.CreatePatch(model); var response = new ApiClientRequestModel(); patch.ApplyTo(response); response.Email.Should().Be("A"); response.FirstName.Should().Be("A"); response.LastName.Should().Be("A"); response.Note.Should().Be("A"); response.Phone.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()); ApiClientResponseModel model = await client.ClientGetAsync(1); ApiClientModelMapper mapper = new ApiClientModelMapper(); UpdateResponse <ApiClientResponseModel> updateResponse = await client.ClientUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }