public async void TestUpdate() { var model = await this.CreateRecord(); ApiTransactionHistoryModelMapper mapper = new ApiTransactionHistoryModelMapper(); UpdateResponse <ApiTransactionHistoryResponseModel> updateResponse = await this.Client.TransactionHistoryUpdateAsync(model.TransactionID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void MapResponseToRequest() { var mapper = new ApiTransactionHistoryModelMapper(); var model = new ApiTransactionHistoryResponseModel(); model.SetProperties(1, 1m, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, 1, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), "A"); ApiTransactionHistoryRequestModel response = mapper.MapResponseToRequest(model); response.ActualCost.Should().Be(1m); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.ProductID.Should().Be(1); response.Quantity.Should().Be(1); response.ReferenceOrderID.Should().Be(1); response.ReferenceOrderLineID.Should().Be(1); response.TransactionDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.TransactionType.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()); ApiTransactionHistoryResponseModel model = await client.TransactionHistoryGetAsync(1); ApiTransactionHistoryModelMapper mapper = new ApiTransactionHistoryModelMapper(); UpdateResponse <ApiTransactionHistoryResponseModel> updateResponse = await client.TransactionHistoryUpdateAsync(model.TransactionID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }
public void CreatePatch() { var mapper = new ApiTransactionHistoryModelMapper(); var model = new ApiTransactionHistoryRequestModel(); model.SetProperties(1m, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, 1, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), "A"); JsonPatchDocument <ApiTransactionHistoryRequestModel> patch = mapper.CreatePatch(model); var response = new ApiTransactionHistoryRequestModel(); patch.ApplyTo(response); response.ActualCost.Should().Be(1m); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.ProductID.Should().Be(1); response.Quantity.Should().Be(1); response.ReferenceOrderID.Should().Be(1); response.ReferenceOrderLineID.Should().Be(1); response.TransactionDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.TransactionType.Should().Be("A"); }