Skip to content

Commit

Permalink
Add tests for wallet status transitions and exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Edrisym committed Nov 15, 2024
1 parent b2a7fd0 commit a4991ea
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Wallet_Tests/Wallet_Wallet_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,34 @@ public void Should_Throw_Exception_When_Withdrawal_Amount_Is_Zero_Or_Negative(de
withdrawal.Should().ThrowExactly<InvalidDataException>();
}

[Fact]
public void Should_Set_Status_To_UnderReview_When_Creating_New_Wallet()
{
var wallet = CreateWallet(balance: 100);
wallet.Status.Should().Be(WalletStatus.UnderReview.ToString());
}

[Fact]
public void Should_Change_Status_When_Changing_Wallet_Status()
{
var wallet = CreateWallet(balance: 100);
wallet.Status.Should().Be(WalletStatus.UnderReview.ToString());
}

[Fact]
public void Should_Change_Status_When_Valid_Transition()
{
var wallet = CreateWallet(balance: 100);
wallet.Status.Should().Be(WalletStatus.UnderReview.ToString());
wallet.ChangeStatus(WalletStatus.PendingActivation);
wallet.Status.Should().Be(WalletStatus.PendingActivation.ToString());
}

[Fact]
public void Should_Throw_Exception_When_Invalid_Transition()
{
var wallet = CreateWallet(balance: 100);
var changeStatusOpt = () => wallet.ChangeStatus(WalletStatus.Active);
changeStatusOpt.Should().ThrowExactly<InvalidOperationException>();
}
}

0 comments on commit a4991ea

Please sign in to comment.