Skip to content

Commit

Permalink
add RetryFact
Browse files Browse the repository at this point in the history
  • Loading branch information
terencefan committed Jan 22, 2025
1 parent dc3ed17 commit 06f158a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test/Microsoft.Azure.SignalR.Tests/AckHandlerTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Threading.Tasks;

using Xunit;
Expand All @@ -8,16 +11,16 @@ namespace Microsoft.Azure.SignalR.Tests;
public class AckHandlerTest
{
[Fact]
public void TestOnce()
public async Task TestOnce()
{
var handler = new AckHandler();
var task = handler.CreateSingleAck(out var ackId);
handler.TriggerAck(ackId);
Assert.True(task.IsCompletedSuccessfully);
Assert.Equal(AckStatus.Ok, task.Result);
Assert.Equal(AckStatus.Ok, await task);
}

[Fact]
[RetryFact]
public async Task TestOnce_Timeout()
{
var handler = new AckHandler(TimeSpan.FromSeconds(1), TimeSpan.FromMilliseconds(20));
Expand Down Expand Up @@ -65,7 +68,7 @@ public async Task TestTwice_Timeout()
await Task.Delay(TimeSpan.FromSeconds(1.5));
Assert.True(task.IsCompleted);
// This assertion is different from RT for different behaviour when timeout of AckHandler. See annotation in AckHandler.cs method CheckAcs
Assert.Equal(AckStatus.Timeout, task.Result);
Assert.Equal(AckStatus.Timeout, await task);
}

[Fact]
Expand Down

0 comments on commit 06f158a

Please sign in to comment.