public async void TestUpdate() { var model = await this.CreateRecord(); ApiSalesTaxRateModelMapper mapper = new ApiSalesTaxRateModelMapper(); UpdateResponse <ApiSalesTaxRateResponseModel> updateResponse = await this.Client.SalesTaxRateUpdateAsync(model.SalesTaxRateID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void MapResponseToRequest() { var mapper = new ApiSalesTaxRateModelMapper(); var model = new ApiSalesTaxRateResponseModel(); model.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM"), "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), 1, 1m, 1); ApiSalesTaxRateRequestModel response = mapper.MapResponseToRequest(model); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Name.Should().Be("A"); response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); response.StateProvinceID.Should().Be(1); response.TaxRate.Should().Be(1m); response.TaxType.Should().Be(1); }
public void CreatePatch() { var mapper = new ApiSalesTaxRateModelMapper(); var model = new ApiSalesTaxRateRequestModel(); model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), 1, 1m, 1); JsonPatchDocument <ApiSalesTaxRateRequestModel> patch = mapper.CreatePatch(model); var response = new ApiSalesTaxRateRequestModel(); patch.ApplyTo(response); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Name.Should().Be("A"); response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); response.StateProvinceID.Should().Be(1); response.TaxRate.Should().Be(1m); response.TaxType.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()); ApiSalesTaxRateResponseModel model = await client.SalesTaxRateGetAsync(1); ApiSalesTaxRateModelMapper mapper = new ApiSalesTaxRateModelMapper(); UpdateResponse <ApiSalesTaxRateResponseModel> updateResponse = await client.SalesTaxRateUpdateAsync(model.SalesTaxRateID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }