public async void TestUpdate() { var model = await this.CreateRecord(); ApiEmailAddressModelMapper mapper = new ApiEmailAddressModelMapper(); UpdateResponse <ApiEmailAddressResponseModel> updateResponse = await this.Client.EmailAddressUpdateAsync(model.BusinessEntityID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void MapResponseToRequest() { var mapper = new ApiEmailAddressModelMapper(); var model = new ApiEmailAddressResponseModel(); model.SetProperties(1, "A", 1, DateTime.Parse("1/1/1987 12:00:00 AM"), Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); ApiEmailAddressRequestModel response = mapper.MapResponseToRequest(model); response.EmailAddress1.Should().Be("A"); response.EmailAddressID.Should().Be(1); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); }
public void CreatePatch() { var mapper = new ApiEmailAddressModelMapper(); var model = new ApiEmailAddressRequestModel(); model.SetProperties("A", 1, DateTime.Parse("1/1/1987 12:00:00 AM"), Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); JsonPatchDocument <ApiEmailAddressRequestModel> patch = mapper.CreatePatch(model); var response = new ApiEmailAddressRequestModel(); patch.ApplyTo(response); response.EmailAddress1.Should().Be("A"); response.EmailAddressID.Should().Be(1); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); 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()); ApiEmailAddressResponseModel model = await client.EmailAddressGetAsync(1); ApiEmailAddressModelMapper mapper = new ApiEmailAddressModelMapper(); UpdateResponse <ApiEmailAddressResponseModel> updateResponse = await client.EmailAddressUpdateAsync(model.BusinessEntityID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }