Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Edrisym committed Nov 20, 2024
1 parent 1d1e93a commit 9af8b02
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Wallet_Tests/Wallet_CurrencyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ private static Currency CreateCurrency(string code = "USD", string name = "Unite
public void Should_Throw_Exception_If_Ratio_Is_Negative(decimal ratio)
{
var currencyCreation = () => CreateCurrency(ratio: ratio);
currencyCreation.Should().ThrowExactly<ArgumentOutOfRangeException>();
currencyCreation.Should().ThrowExactly<InvalidCurrencyRatioException>();
}

[Fact]
Expand Down
12 changes: 5 additions & 7 deletions Wallet_Tests/Wallet_Wallet_Tests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

namespace Wallet_Tests;

public class WalletTests
Expand All @@ -9,7 +8,7 @@ private static Currency CreateCurrency(string code = "USD", string name = "Unite
private static Wallet CreateWallet(decimal balance, decimal ratio = 1.99m)
{
var currency = CreateCurrency(ratio: ratio);
return Wallet.Create(balance, currency);
return Wallet.Create(balance, currency.Id);
}

[Fact]
Expand All @@ -33,12 +32,11 @@ public void Should_Throw_Exception_If_No_Default_Currency_Is_Set()
walletCreation.Should().ThrowExactly<ArgumentNullException>();
}

[Theory]
[InlineData("USD", "United States Dollar", 0.99)]
public void Should_Throw_Exception_If_InitialBalance_Is_Under_Limit(string code, string name, decimal ratio)
[Fact]
public void Should_Throw_Exception_If_InitialBalance_Is_Under_Limit()
{
var currency = CreateCurrency(code, name, ratio);
var walletCreation = () => Wallet.Create(0.0m, currency);
var currency = CreateCurrency("USD", "United States Dollar", 1.0m);
var walletCreation = () => Wallet.Create(0.0m, currency.Id);
walletCreation.Should().ThrowExactly<InsufficientInitialBalanceException>();
}

Expand Down

0 comments on commit 9af8b02

Please sign in to comment.