-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
85 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
.../EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/IOrderLinePriceOverrider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
using System.Threading.Tasks; | ||
using EasyAbp.EShop.Orders.Orders.Dtos; | ||
using EasyAbp.EShop.Products.Products.Dtos; | ||
using NodaMoney; | ||
|
||
namespace EasyAbp.EShop.Orders.Orders; | ||
|
||
public interface IOrderLinePriceOverrider | ||
{ | ||
Task<decimal?> GetUnitPriceOrNullAsync(CreateOrderDto input, CreateOrderLineDto inputOrderLine, ProductDto product, | ||
ProductSkuDto productSku); | ||
Task<Money?> GetUnitPriceOrNullAsync(CreateOrderDto input, CreateOrderLineDto inputOrderLine, ProductDto product, | ||
ProductSkuDto productSku, Currency effectiveCurrency); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...EasyAbp.EShop.Products/test/EasyAbp.EShop.Products.Domain.Tests/Products/CurrencyTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using NodaMoney; | ||
using Shouldly; | ||
using Xunit; | ||
|
||
namespace EasyAbp.EShop.Products.Products; | ||
|
||
public class CurrencyTests : ProductsDomainTestBase | ||
{ | ||
[Fact] | ||
public Task Should_Rounding_If_Amount_Is_Out_Of_Decimals() | ||
{ | ||
var money = new Money(1.115m, Currency.FromCode("CNY")); | ||
|
||
money.Currency.ShouldBe(Currency.FromCode("CNY")); | ||
money.Amount.ShouldBe(1.12m); | ||
|
||
return Task.CompletedTask; | ||
} | ||
[Fact] | ||
public Task Should_Throw_If_Currency_Is_Undefined() | ||
{ | ||
var exception = Should.Throw<ArgumentException>(() => new Money(1.115m, Currency.FromCode("BTC"))); | ||
|
||
exception.Message.ShouldBe("BTC is an unknown currency code!"); | ||
|
||
return Task.CompletedTask; | ||
} | ||
} |