public async void TestUpdate() { var model = await this.CreateRecord(); ApiVendorModelMapper mapper = new ApiVendorModelMapper(); UpdateResponse <ApiVendorResponseModel> updateResponse = await this.Client.VendorUpdateAsync(model.BusinessEntityID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void MapResponseToRequest() { var mapper = new ApiVendorModelMapper(); var model = new ApiVendorResponseModel(); model.SetProperties(1, "A", true, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), "A", true, "A"); ApiVendorRequestModel response = mapper.MapResponseToRequest(model); response.AccountNumber.Should().Be("A"); response.ActiveFlag.Should().Be(true); response.CreditRating.Should().Be(1); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Name.Should().Be("A"); response.PreferredVendorStatu.Should().Be(true); response.PurchasingWebServiceURL.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()); ApiVendorResponseModel model = await client.VendorGetAsync(1); ApiVendorModelMapper mapper = new ApiVendorModelMapper(); UpdateResponse <ApiVendorResponseModel> updateResponse = await client.VendorUpdateAsync(model.BusinessEntityID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }
public void CreatePatch() { var mapper = new ApiVendorModelMapper(); var model = new ApiVendorRequestModel(); model.SetProperties("A", true, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), "A", true, "A"); JsonPatchDocument <ApiVendorRequestModel> patch = mapper.CreatePatch(model); var response = new ApiVendorRequestModel(); patch.ApplyTo(response); response.AccountNumber.Should().Be("A"); response.ActiveFlag.Should().Be(true); response.CreditRating.Should().Be(1); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Name.Should().Be("A"); response.PreferredVendorStatu.Should().Be(true); response.PurchasingWebServiceURL.Should().Be("A"); }