Skip to content

Commit 2ec248b

Browse files
committed
refactor: only skip tests on .net 6 or lower
1 parent eaa5b9a commit 2ec248b

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

test/TimeProviderExtensions.Tests/ManualTimeProviderDelayTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ public void Delayed_task_is_completes()
1515
task.Status.Should().Be(TaskStatus.RanToCompletion);
1616
}
1717

18+
#if NET8_0_OR_GREATER
1819
[Fact]
20+
#else
21+
[Fact(Skip = "Bug in .NET 7 and earlier - https://github.com/dotnet/runtime/issues/92264")]
22+
#endif
1923
public void Delayed_task_is_cancelled()
2024
{
2125
using var cts = new CancellationTokenSource();

test/TimeProviderExtensions.Tests/ManualTimeProviderTests.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public void SetUtcNow_updates_UtcNow()
2323

2424
sut.GetUtcNow().Should().Be(startTime + TimeSpan.FromTicks(1));
2525
}
26-
#if NET8_0_OR_GREATER
26+
2727
[Fact]
2828
public async Task Delay_callbacks_runs_synchronously()
2929
{
@@ -46,7 +46,11 @@ static async Task Continuation(TimeProvider timeProvider, Action callback)
4646
}
4747
}
4848

49+
#if NET8_0_OR_GREATER
4950
[Fact]
51+
#else
52+
[Fact(Skip = "Bug in .NET 7 and earlier - https://github.com/dotnet/runtime/issues/92264")]
53+
#endif
5054
public async Task WaitAsync_callbacks_runs_synchronously()
5155
{
5256
// arrange
@@ -65,7 +69,8 @@ static async Task Continuation(TimeProvider timeProvider, Action callback)
6569
{
6670
try
6771
{
68-
await Task.Delay(TimeSpan.FromDays(1))
72+
await Task
73+
.Delay(TimeSpan.FromDays(1))
6974
.WaitAsync(TimeSpan.FromSeconds(10), timeProvider);
7075
}
7176
catch (TimeoutException)
@@ -74,10 +79,9 @@ await Task.Delay(TimeSpan.FromDays(1))
7479
}
7580
}
7681
}
77-
#endif
7882

7983
#if !NET8_0_OR_GREATER && NET6_0_OR_GREATER
80-
[Fact(Skip = "Include after NET 8 rc1 release")]
84+
[Fact]
8185
public async Task Callbacks_happens_in_schedule_order()
8286
{
8387
var sut = new ManualTimeProvider();

test/TimeProviderExtensions.Tests/Microsoft.Extensions.Time.Testing.Test/FakeTimeProviderTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
// Licensed to the .NET Foundation under one or more agreements.
66
// The .NET Foundation licenses this file to you under the MIT license.
77

8-
using FakeTimeProvider = TimeProviderExtensions.ManualTimeProvider;
9-
108
namespace Microsoft.Extensions.Time.Testing.Test;
119

10+
using FakeTimeProvider = TimeProviderExtensions.ManualTimeProvider;
11+
1212
public class ManualTimeProviderTests
1313
{
1414
[Fact]

test/TimeProviderExtensions.Tests/Microsoft.Extensions.Time.Testing.Test/TimerTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
// Licensed to the .NET Foundation under one or more agreements.
66
// The .NET Foundation licenses this file to you under the MIT license.
77

8-
using FakeTimeProvider = TimeProviderExtensions.ManualTimeProvider;
9-
108
namespace Microsoft.Extensions.Time.Testing.Test;
119

10+
using FakeTimeProvider = TimeProviderExtensions.ManualTimeProvider;
11+
1212
public class TimerTests
1313
{
1414
private void EmptyTimerTarget(object? o)

0 commit comments

Comments
 (0)