Fix WrongPhase async timing issues
MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/ConfirmConnectionTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/ConfirmConnectionTests.cs
@@ -86,11 +86,12 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend
public async Task WrongPhaseAsync()
{
WabiSabiConfig cfg = new();
- var round = WabiSabiFactory.CreateRound(cfg);
var alice = WabiSabiFactory.CreateAlice();
var preDeadline = alice.Deadline;
+ using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg);
+ await arena.TriggerAndWaitRoundAsync(TimeSpan.FromSeconds(21)).ConfigureAwait(false);
+ var round = arena.Rounds.First().Value;
round.Alices.Add(alice);
- using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
var req = WabiSabiFactory.CreateConnectionConfirmationRequest(round);
foreach (Phase phase in Enum.GetValues(typeof(Phase)))

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/RegisterInputTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/RegisterInputTests.cs
@@ -110,12 +110,13 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend
public async Task WrongPhaseAsync()
{
WabiSabiConfig cfg = new();
- var round = WabiSabiFactory.CreateRound(cfg);
- using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
+ using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg);
+ await arena.TriggerAndWaitRoundAsync(TimeSpan.FromSeconds(21)).ConfigureAwait(false);
+ var round = arena.Rounds.First().Value;
using Key key = new();
-
var req = WabiSabiFactory.CreateInputsRegistrationRequest(key, round);
await using PostRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
+
foreach (Phase phase in Enum.GetValues(typeof(Phase)))
{
if (phase != Phase.InputRegistration)

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/RegisterOutputTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/RegisterOutputTests.cs
@@ -126,10 +126,11 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend
public async Task WrongPhaseAsync()
{
WabiSabiConfig cfg = new();
- var round = WabiSabiFactory.CreateRound(cfg);
- round.Alices.Add(WabiSabiFactory.CreateAlice());
- using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
+ using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg);
await using PostRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
+ await arena.TriggerAndWaitRoundAsync(TimeSpan.FromSeconds(21)).ConfigureAwait(false);
+ var round = arena.Rounds.First().Value;
+ round.Alices.Add(WabiSabiFactory.CreateAlice());
foreach (Phase phase in Enum.GetValues(typeof(Phase)))
{

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/RemoveInputTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/RemoveInputTests.cs
@@ -56,8 +56,9 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend
public async Task WrongPhaseAsync()
{
WabiSabiConfig cfg = new();
- var round = WabiSabiFactory.CreateRound(cfg);
- using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
+ using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg);
+ await arena.TriggerAndWaitRoundAsync(TimeSpan.FromSeconds(21)).ConfigureAwait(false);
+ var round = arena.Rounds.First().Value;
var req = new InputsRemovalRequest(round.Id, Guid.NewGuid());
foreach (Phase phase in Enum.GetValues(typeof(Phase)))

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/SignTransactionTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/SignTransactionTests.cs
@@ -56,8 +56,9 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend
public async Task WrongPhaseAsync()
{
WabiSabiConfig cfg = new();
- var round = WabiSabiFactory.CreateRound(cfg);
- using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
+ using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg);
+ await arena.TriggerAndWaitRoundAsync(TimeSpan.FromSeconds(21)).ConfigureAwait(false);
+ var round = arena.Rounds.First().Value;
var req = new TransactionSignaturesRequest(round.Id, null!);
foreach (Phase phase in Enum.GetValues(typeof(Phase)))

Fix WrongPhase async timing issues