Skip to content

Commit

Permalink
Tests: clean DB after run in tests
Browse files Browse the repository at this point in the history
Clean DB after each test run in BasicTests, MakerOnlyOrders,
MarketOrders, and LimitOrders test classes. This is needed for
all tests to start from empty state.
  • Loading branch information
webwarrior-ws committed Sep 4, 2024
1 parent dd437fc commit bc5181a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/FX.Tests/BasicTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ internal static void ClearRedisStorage()
}
}

[TearDown]
public void TearDown()
{
ClearRedisStorage();
}

internal static IEnumerable<Exchange> CreateExchangesOfDifferentTypes()
{
yield return new Exchange(Persistence.Memory);
Expand Down
6 changes: 6 additions & 0 deletions src/FX.Tests/LimitOrders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ namespace FsharpExchange.Tests
[TestFixture]
public class LimitOrders
{
[TearDown]
public void TearDown()
{
BasicTests.ClearRedisStorage();
}

internal static FSharpOption<Match> SendOrder(Exchange exchange,
LimitOrder limitOrder,
Market market)
Expand Down
6 changes: 6 additions & 0 deletions src/FX.Tests/MakerOnlyOrders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ namespace FsharpExchange.Tests
[TestFixture]
public class MakerOnlyOrders
{
[TearDown]
public void TearDown()
{
BasicTests.ClearRedisStorage();
}

internal static IEnumerable<Exchange>
Limit_order_is_accepted_by_empty_exchange
(LimitOrder limitOrder,
Expand Down
6 changes: 6 additions & 0 deletions src/FX.Tests/MarketOrders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ namespace FsharpExchange.Tests
[TestFixture]
public class MarketOrders
{
[TearDown]
public void TearDown()
{
BasicTests.ClearRedisStorage();
}

private void Market_order_exact_match_on_exchange_with_one_limit_order(Side side)
{
var quantity = 1;
Expand Down

0 comments on commit bc5181a

Please sign in to comment.