public async void TestUpdate() { var model = await this.CreateRecord(); ApiBusinessEntityContactModelMapper mapper = new ApiBusinessEntityContactModelMapper(); UpdateResponse <ApiBusinessEntityContactResponseModel> updateResponse = await this.Client.BusinessEntityContactUpdateAsync(model.BusinessEntityID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void MapResponseToRequest() { var mapper = new ApiBusinessEntityContactModelMapper(); var model = new ApiBusinessEntityContactResponseModel(); model.SetProperties(1, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); ApiBusinessEntityContactRequestModel response = mapper.MapResponseToRequest(model); response.ContactTypeID.Should().Be(1); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.PersonID.Should().Be(1); response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); }
public void CreatePatch() { var mapper = new ApiBusinessEntityContactModelMapper(); var model = new ApiBusinessEntityContactRequestModel(); model.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); JsonPatchDocument <ApiBusinessEntityContactRequestModel> patch = mapper.CreatePatch(model); var response = new ApiBusinessEntityContactRequestModel(); patch.ApplyTo(response); response.ContactTypeID.Should().Be(1); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.PersonID.Should().Be(1); response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); }
public async void TestUpdate() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); ApiBusinessEntityContactResponseModel model = await client.BusinessEntityContactGetAsync(1); ApiBusinessEntityContactModelMapper mapper = new ApiBusinessEntityContactModelMapper(); UpdateResponse <ApiBusinessEntityContactResponseModel> updateResponse = await client.BusinessEntityContactUpdateAsync(model.BusinessEntityID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }