Skip to content

Commit 12eacfd

Browse files
committed
refactor: make Microsofts FakeTimeProvider internal
1 parent 05f53e6 commit 12eacfd

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

src/TimeProviderExtensions/Microsoft.Extensions.Time.Testing/FakeTimeProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace Microsoft.Extensions.Time.Testing;
1212
/// <summary>
1313
/// A synthetic clock used to provide deterministic behavior in tests.
1414
/// </summary>
15-
public class FakeTimeProvider : TimeProvider
15+
internal class FakeTimeProvider : TimeProvider
1616
{
1717
internal static readonly DateTimeOffset Epoch = new(2000, 1, 1, 0, 0, 0, 0, TimeSpan.Zero);
1818

src/TimeProviderExtensions/TimeProviderExtensions.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,9 @@
6767
</None>
6868
</ItemGroup>
6969

70+
<ItemGroup>
71+
<!-- Makes internal types in libraries visible to their test projects -->
72+
<InternalsVisibleTo Include="$(AssemblyName).Tests" />
73+
</ItemGroup>
74+
7075
</Project>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// This file is used by Code Analysis to maintain SuppressMessage
2+
// attributes that are applied to this project.
3+
// Project-level suppressions either have no target or are given
4+
// a specific target and scoped to a namespace, type, member, etc.
5+
6+
using System.Diagnostics.CodeAnalysis;
7+
8+
[assembly: SuppressMessage("Usage", "xUnit1000:Test classes must be public", Justification = "I want to test internal files")]

test/TimeProviderExtensions.Tests/ManualTimeProviderWaitAsyncTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace TimeProviderExtensions;
99

10-
public class ManualTimeProviderWaitAsyncTests
10+
internal class ManualTimeProviderWaitAsyncTests
1111
{
1212
internal const uint MaxSupportedTimeout = 0xfffffffe;
1313
private readonly static TimeSpan DelayedTaskDelay = TimeSpan.FromMilliseconds(2);

0 commit comments

Comments
 (0)