Skip to content

Commit

Permalink
More namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Tratcher committed Oct 9, 2023
1 parent 3e4e2fc commit c6ff1a3
Show file tree
Hide file tree
Showing 23 changed files with 48 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -792,9 +792,9 @@ public class InnerType
using System;
using System.Threading;
namespace Microsoft.Extensions.Time.Testing;
namespace Microsoft.Extensions.TimeProvider.Testing;
public class FakeTimeProvider : TimeProvider
public class FakeTimeProvider : System.TimeProvider
{
public FakeTimeProvider() { }
public FakeTimeProvider(DateTimeOffset startDateTime) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,64 +2,64 @@
"Name": "Microsoft.Extensions.TimeProvider.Testing, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
"Types": [
{
"Type": "class Microsoft.Extensions.Time.Testing.FakeTimeProvider : System.TimeProvider",
"Type": "class Microsoft.Extensions.TimeProvider.Testing.FakeTimeProvider : System.TimeProvider",
"Stage": "Experimental",
"Methods": [
{
"Member": "Microsoft.Extensions.Time.Testing.FakeTimeProvider.FakeTimeProvider();",
"Member": "Microsoft.Extensions.TimeProvider.Testing.FakeTimeProvider.FakeTimeProvider();",
"Stage": "Experimental"
},
{
"Member": "Microsoft.Extensions.Time.Testing.FakeTimeProvider.FakeTimeProvider(System.DateTimeOffset startDateTime);",
"Member": "Microsoft.Extensions.TimeProvider.Testing.FakeTimeProvider.FakeTimeProvider(System.DateTimeOffset startDateTime);",
"Stage": "Experimental"
},
{
"Member": "void Microsoft.Extensions.Time.Testing.FakeTimeProvider.Advance(System.TimeSpan delta);",
"Member": "void Microsoft.Extensions.TimeProvider.Testing.FakeTimeProvider.Advance(System.TimeSpan delta);",
"Stage": "Experimental"
},
{
"Member": "override System.Threading.ITimer Microsoft.Extensions.Time.Testing.FakeTimeProvider.CreateTimer(System.Threading.TimerCallback callback, object? state, System.TimeSpan dueTime, System.TimeSpan period);",
"Member": "override System.Threading.ITimer Microsoft.Extensions.TimeProvider.Testing.FakeTimeProvider.CreateTimer(System.Threading.TimerCallback callback, object? state, System.TimeSpan dueTime, System.TimeSpan period);",
"Stage": "Experimental"
},
{
"Member": "override long Microsoft.Extensions.Time.Testing.FakeTimeProvider.GetTimestamp();",
"Member": "override long Microsoft.Extensions.TimeProvider.Testing.FakeTimeProvider.GetTimestamp();",
"Stage": "Experimental"
},
{
"Member": "override System.DateTimeOffset Microsoft.Extensions.Time.Testing.FakeTimeProvider.GetUtcNow();",
"Member": "override System.DateTimeOffset Microsoft.Extensions.TimeProvider.Testing.FakeTimeProvider.GetUtcNow();",
"Stage": "Experimental"
},
{
"Member": "void Microsoft.Extensions.Time.Testing.FakeTimeProvider.SetLocalTimeZone(System.TimeZoneInfo localTimeZone);",
"Member": "void Microsoft.Extensions.TimeProvider.Testing.FakeTimeProvider.SetLocalTimeZone(System.TimeZoneInfo localTimeZone);",
"Stage": "Experimental"
},
{
"Member": "void Microsoft.Extensions.Time.Testing.FakeTimeProvider.SetUtcNow(System.DateTimeOffset value);",
"Member": "void Microsoft.Extensions.TimeProvider.Testing.FakeTimeProvider.SetUtcNow(System.DateTimeOffset value);",
"Stage": "Experimental"
},
{
"Member": "override string Microsoft.Extensions.Time.Testing.FakeTimeProvider.ToString();",
"Member": "override string Microsoft.Extensions.TimeProvider.Testing.FakeTimeProvider.ToString();",
"Stage": "Experimental"
}
],
"Properties": [
{
"Member": "System.TimeSpan Microsoft.Extensions.Time.Testing.FakeTimeProvider.AutoAdvanceAmount { get; set; }",
"Member": "System.TimeSpan Microsoft.Extensions.TimeProvider.Testing.FakeTimeProvider.AutoAdvanceAmount { get; set; }",
"Stage": "Experimental"
},
{
"Member": "override System.TimeZoneInfo Microsoft.Extensions.Time.Testing.FakeTimeProvider.LocalTimeZone { get; }",
"Member": "override System.TimeZoneInfo Microsoft.Extensions.TimeProvider.Testing.FakeTimeProvider.LocalTimeZone { get; }",
"Stage": "Experimental"
},
{
"Member": "System.DateTimeOffset Microsoft.Extensions.Time.Testing.FakeTimeProvider.Start { get; }",
"Member": "System.DateTimeOffset Microsoft.Extensions.TimeProvider.Testing.FakeTimeProvider.Start { get; }",
"Stage": "Experimental"
},
{
"Member": "override long Microsoft.Extensions.Time.Testing.FakeTimeProvider.TimestampFrequency { get; }",
"Member": "override long Microsoft.Extensions.TimeProvider.Testing.FakeTimeProvider.TimestampFrequency { get; }",
"Stage": "Experimental"
}
]
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging.Testing;
using Microsoft.Extensions.Time.Testing;
using Microsoft.Extensions.TimeProvider.Testing;
using Xunit;

namespace Microsoft.Extensions.Diagnostics.Probes.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using Microsoft.Extensions.Time.Testing;
using Microsoft.Extensions.TimeProvider.Testing;
using Xunit;

namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using Microsoft.Extensions.Time.Testing;
using Microsoft.Extensions.TimeProvider.Testing;

namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring.Test.Helpers;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Hosting.Testing;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Time.Testing;
using Microsoft.Extensions.TimeProvider.Testing;
using Microsoft.TestUtilities;
using Xunit;

Expand Down Expand Up @@ -180,7 +180,7 @@ public Task ResourceUtilizationTracker_Reports_The_Same_Values_As_One_Can_Observ

using var host = FakeHost.CreateBuilder().ConfigureServices(x =>
x.AddLogging()
.AddSingleton<TimeProvider>(clock)
.AddSingleton<System.TimeProvider>(clock)
.AddSingleton<IUserHz>(new FakeUserHz(100))
.AddSingleton<IFileSystem>(fileSystem)
.AddSingleton<IResourceUtilizationPublisher>(new GenericPublisher(_ => e.Set()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void LinuxCounters_Registers_Instruments()
});

var parser = new LinuxUtilizationParser(fileSystem: fileSystem, new FakeUserHz(100));
var provider = new LinuxUtilizationProvider(options, parser, meterFactoryMock.Object, TimeProvider.System);
var provider = new LinuxUtilizationProvider(options, parser, meterFactoryMock.Object, System.TimeProvider.System);

using var listener = new MeterListener
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using Microsoft.Extensions.Time.Testing;
using Microsoft.Extensions.TimeProvider.Testing;

namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring.Test.Providers;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using Microsoft.Extensions.Time.Testing;
using Microsoft.Extensions.TimeProvider.Testing;

namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring.Test.Providers;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using Microsoft.Extensions.Time.Testing;
using Microsoft.Extensions.TimeProvider.Testing;

namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring.Test.Providers;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void AddResourceUtilization_AddsResourceMonitoringService_ToServicesColle
{
using var provider = new ServiceCollection()
.AddLogging()
.AddSingleton<TimeProvider>(TimeProvider.System)
.AddSingleton<System.TimeProvider>(System.TimeProvider.System)
.AddResourceMonitoring(builder =>
{
builder.Services.AddSingleton<ISnapshotProvider, FakeProvider>();
Expand All @@ -53,7 +53,7 @@ public void AddResourceUtilization_AddsResourceMonitoringService_ToServicesColle
{
using var provider = new ServiceCollection()
.AddLogging()
.AddSingleton<TimeProvider>(TimeProvider.System)
.AddSingleton<System.TimeProvider>(System.TimeProvider.System)
.AddResourceMonitoring()
.BuildServiceProvider();

Expand All @@ -69,7 +69,7 @@ public void AddResourceUtilization_AddsResourceMonitoringService_AsHostedService
{
using var provider = new ServiceCollection()
.AddLogging()
.AddSingleton<TimeProvider>(TimeProvider.System)
.AddSingleton<System.TimeProvider>(System.TimeProvider.System)
.AddResourceMonitoring(builder =>
{
builder.Services.AddSingleton<ISnapshotProvider, FakeProvider>();
Expand All @@ -93,7 +93,7 @@ public void ConfigureResourceUtilization_InitializeTrackerProperly()
{
services.AddResourceMonitoring(builder =>
{
builder.Services.AddSingleton<TimeProvider>(TimeProvider.System);
builder.Services.AddSingleton<System.TimeProvider>(System.TimeProvider.System);
builder.Services.AddSingleton<ISnapshotProvider, FakeProvider>();
builder.AddPublisher<EmptyPublisher>();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Logging.Testing;
using Microsoft.Extensions.Time.Testing;
using Microsoft.Extensions.TimeProvider.Testing;
using Moq;
using Xunit;
using static Microsoft.Extensions.Options.Options;
Expand Down Expand Up @@ -83,7 +83,7 @@ public void BasicConstructor_NullPublishers_Throws()
var mockLogger = new Mock<ILogger<ResourceMonitorService>>(MockBehavior.Loose);

Assert.Throws<ArgumentNullException>(() =>
new ResourceMonitorService(mockProvider.Object, mockLogger.Object, Create(new ResourceMonitoringOptions()), null!, TimeProvider.System));
new ResourceMonitorService(mockProvider.Object, mockLogger.Object, Create(new ResourceMonitoringOptions()), null!, System.TimeProvider.System));
}

/// <summary>
Expand Down Expand Up @@ -693,7 +693,7 @@ public void GetUtilization_ProvidedByWindowGreaterThanBuffer_ThrowsArgumentOutOf
public async Task Disposing_Service_Twice_Does_Not_Throw()
{
using var s = new ResourceMonitorService(new FakeProvider(), NullLogger<ResourceMonitorService>.Instance,
Microsoft.Extensions.Options.Options.Create(new ResourceMonitoringOptions()), Array.Empty<IResourceUtilizationPublisher>(), TimeProvider.System);
Microsoft.Extensions.Options.Options.Create(new ResourceMonitoringOptions()), Array.Empty<IResourceUtilizationPublisher>(), System.TimeProvider.System);

var r = await Record.ExceptionAsync(async () =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using Microsoft.Extensions.Time.Testing;
using Microsoft.Extensions.TimeProvider.Testing;
using Xunit;

namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System;
using System.Globalization;
using Microsoft.Extensions.Time.Testing;
using Microsoft.Extensions.TimeProvider.Testing;
using Xunit;
using Xunit.Abstractions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using System.Threading;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Testing;
using Microsoft.Extensions.Time.Testing;
using Microsoft.Extensions.TimeProvider.Testing;
using Xunit;

namespace Microsoft.Extensions.Logging.Testing.Test.Logging;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Time.Testing;
using Microsoft.Extensions.TimeProvider.Testing;
using Xunit;

namespace Microsoft.Extensions.Diagnostics.Metrics.Testing.Test;
Expand Down Expand Up @@ -324,7 +324,7 @@ public static async Task WaitWithTimeout()
Assert.Equal(1, collector.WaitersCount);

// Task should be complete. Error if not complete after delay.
await wait.WaitAsync(TimeSpan.FromSeconds(5), TimeProvider.System);
await wait.WaitAsync(TimeSpan.FromSeconds(5), System.TimeProvider.System);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Testing;
using Microsoft.Extensions.Time.Testing;
using Microsoft.Extensions.TimeProvider.Testing;
using Moq;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging.Testing;
using Microsoft.Extensions.Time.Testing;
using Microsoft.Extensions.TimeProvider.Testing;
using Moq;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Logging.Testing;
using Microsoft.Extensions.Telemetry.Internal;
using Microsoft.Extensions.Time.Testing;
using Microsoft.Extensions.TimeProvider.Testing;
using Microsoft.Shared.Collections;
using Moq;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Net.Http.Headers;
using FluentAssertions;
using Microsoft.Extensions.Http.Resilience.Internal;
using Microsoft.Extensions.Time.Testing;
using Microsoft.Extensions.TimeProvider.Testing;
using Xunit;

namespace Microsoft.Extensions.Http.Resilience.Test.Internal;
Expand All @@ -19,7 +19,7 @@ public void TryParse_Delta_Ok()
using var response = new HttpResponseMessage();
response.Headers.RetryAfter = new RetryConditionHeaderValue(TimeSpan.FromSeconds(10));

var parsed = RetryAfterHelper.TryParse(response, TimeProvider.System, out var retryAfter);
var parsed = RetryAfterHelper.TryParse(response, System.TimeProvider.System, out var retryAfter);

parsed.Should().BeTrue();
retryAfter.Should().Be(TimeSpan.FromSeconds(10));
Expand All @@ -30,7 +30,7 @@ public void TryParse_Null_Ok()
{
using var response = new HttpResponseMessage();

var parsed = RetryAfterHelper.TryParse(response, TimeProvider.System, out var retryAfter);
var parsed = RetryAfterHelper.TryParse(response, System.TimeProvider.System, out var retryAfter);

parsed.Should().BeFalse();
retryAfter.Should().Be(default);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Time.Testing;
using Microsoft.Extensions.TimeProvider.Testing;
using Xunit;

namespace Microsoft.Extensions.Time.Testing.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RootNamespace>Microsoft.Extensions.Time.Testing.Test</RootNamespace>
<RootNamespace>Microsoft.Extensions.TimeProvider.Testing.Test</RootNamespace>
<Description>Tests for Microsoft.Extensions.TimeProvider.Testing</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Time.Testing;
using Microsoft.Extensions.TimeProvider.Testing;
using Xunit;
using Timer = Microsoft.Extensions.TimeProvider.Testing.Timer;

namespace Microsoft.Extensions.Time.Testing.Test;

Expand Down

0 comments on commit c6ff1a3

Please sign in to comment.