public void MapResponseToRequest() { var mapper = new ApiTransactionModelMapper(); var model = new ApiTransactionResponseModel(); model.SetProperties(1, 1m, "A", 1); ApiTransactionRequestModel response = mapper.MapResponseToRequest(model); response.Amount.Should().Be(1m); response.GatewayConfirmationNumber.Should().Be("A"); response.TransactionStatusId.Should().Be(1); }
public async void TestUpdate() { var model = await this.CreateRecord(); ApiTransactionModelMapper mapper = new ApiTransactionModelMapper(); UpdateResponse <ApiTransactionResponseModel> updateResponse = await this.Client.TransactionUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void MapClientResponseToRequest() { var mapper = new ApiTransactionModelMapper(); var model = new ApiTransactionClientResponseModel(); model.SetProperties(1, 1m, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), "A"); ApiTransactionClientRequestModel response = mapper.MapClientResponseToRequest(model); response.Should().NotBeNull(); response.Amount.Should().Be(1m); response.ArtistId.Should().Be(1); response.DateCreated.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.StripeTransactionId.Should().Be("A"); }
public void CreatePatch() { var mapper = new ApiTransactionModelMapper(); var model = new ApiTransactionRequestModel(); model.SetProperties(1m, "A", 1); JsonPatchDocument <ApiTransactionRequestModel> patch = mapper.CreatePatch(model); var response = new ApiTransactionRequestModel(); patch.ApplyTo(response); response.Amount.Should().Be(1m); response.GatewayConfirmationNumber.Should().Be("A"); response.TransactionStatusId.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()); ApiTransactionResponseModel model = await client.TransactionGetAsync(1); ApiTransactionModelMapper mapper = new ApiTransactionModelMapper(); UpdateResponse <ApiTransactionResponseModel> updateResponse = await client.TransactionUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }