public virtual async void TestDelete() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext; ITransactionService service = testServer.Host.Services.GetService(typeof(ITransactionService)) as ITransactionService; var model = new ApiTransactionServerRequestModel(); model.SetProperties(2m, "B", 1); CreateResponse <ApiTransactionServerResponseModel> createdResponse = await service.Create(model); createdResponse.Success.Should().BeTrue(); ActionResponse deleteResult = await client.TransactionDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiTransactionServerResponseModel verifyResponse = await service.Get(2); verifyResponse.Should().BeNull(); }
public void MapServerRequestToResponse() { var mapper = new ApiTransactionServerModelMapper(); var model = new ApiTransactionServerRequestModel(); model.SetProperties(1m, "A", 1); ApiTransactionServerResponseModel response = mapper.MapServerRequestToResponse(1, model); response.Should().NotBeNull(); response.Amount.Should().Be(1m); response.GatewayConfirmationNumber.Should().Be("A"); response.TransactionStatusId.Should().Be(1); }
public void MapServerRequestToResponse() { var mapper = new ApiTransactionServerModelMapper(); var model = new ApiTransactionServerRequestModel(); model.SetProperties(1m, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), "A"); ApiTransactionServerResponseModel response = mapper.MapServerRequestToResponse(1, 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 ApiTransactionServerModelMapper(); var model = new ApiTransactionServerRequestModel(); model.SetProperties(1m, "A", 1); JsonPatchDocument <ApiTransactionServerRequestModel> patch = mapper.CreatePatch(model); var response = new ApiTransactionServerRequestModel(); patch.ApplyTo(response); response.Amount.Should().Be(1m); response.GatewayConfirmationNumber.Should().Be("A"); response.TransactionStatusId.Should().Be(1); }
public void CreatePatch() { var mapper = new ApiTransactionServerModelMapper(); var model = new ApiTransactionServerRequestModel(); model.SetProperties(1m, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), "A"); JsonPatchDocument <ApiTransactionServerRequestModel> patch = mapper.CreatePatch(model); var response = new ApiTransactionServerRequestModel(); patch.ApplyTo(response); 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"); }