mirror of https://github.com/abpframework/eventhub
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.4 KiB
48 lines
1.4 KiB
using System;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.Options;
|
|
using Shouldly;
|
|
using Xunit;
|
|
|
|
namespace Payment.PaymentRequests
|
|
{
|
|
public class PaymentRequestAppService_Tests : PaymentApplicationTestBase
|
|
{
|
|
private readonly IPaymentRequestAppService _paymentRequestAppService;
|
|
|
|
public PaymentRequestAppService_Tests()
|
|
{
|
|
_paymentRequestAppService = GetRequiredService<IPaymentRequestAppService>();
|
|
}
|
|
|
|
[Fact]
|
|
public async Task Should_Create_Minimal_Payment_Request()
|
|
{
|
|
var result = await _paymentRequestAppService.CreateAsync(
|
|
new PaymentRequestCreationDto
|
|
{
|
|
ProductName = "My product 1",
|
|
Price = 99.99m
|
|
}
|
|
);
|
|
|
|
result.Id.ShouldNotBe(Guid.Empty);
|
|
result.Price.ShouldBe(99.99m);
|
|
result.ProductName.ShouldBe("My product 1");
|
|
}
|
|
|
|
[Fact]
|
|
public async Task Should_Create_Payment_Request_With_Default_Currency()
|
|
{
|
|
var result = await _paymentRequestAppService.CreateAsync(new PaymentRequestCreationDto
|
|
{
|
|
Price = 4.95m,
|
|
ProductName = "Donation"
|
|
});
|
|
|
|
var options = GetRequiredService<IOptions<PaymentOptions>>();
|
|
|
|
result.Currency.ShouldBe(options.Value.DefaultCurrency);
|
|
}
|
|
}
|
|
}
|