Browse Source

Add test for default currency of PaymentRequestAppService

pull/69/head
enisn 5 years ago
parent
commit
38ff3e5503
  1. 2
      modules/payment/src/Payment.Domain/PaymentOptions.cs
  2. 17
      modules/payment/test/Payment.Application.Tests/PaymentRequests/PaymentRequestAppService_Tests.cs

2
modules/payment/src/Payment.Domain/PaymentOptions.cs

@ -2,6 +2,6 @@
{
public class PaymentOptions
{
public string DefaultCurrency { get; set; }
public string DefaultCurrency { get; set; } = "USD"
}
}

17
modules/payment/test/Payment.Application.Tests/PaymentRequests/PaymentRequestAppService_Tests.cs

@ -1,5 +1,6 @@
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Shouldly;
using Xunit;
@ -24,10 +25,24 @@ namespace Payment.PaymentRequests
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);
}
}
}
Loading…
Cancel
Save