From 72c3b7d9551db2851b3b577b7682915b059552dd Mon Sep 17 00:00:00 2001 From: Paulo Morgado Date: Tue, 4 Sep 2018 11:05:05 +0100 Subject: [PATCH] Added debugger display information to TestScheduler and HistoricalScheduler --- .../Source/src/Microsoft.Reactive.Testing/TestScheduler.cs | 5 +++++ .../src/System.Reactive/Concurrency/HistoricalScheduler.cs | 5 +++++ .../Api/ApiApprovalTests.Core.approved.txt | 1 + .../Api/ApiApprovalTests.Testing.approved.txt | 1 + 4 files changed, 12 insertions(+) diff --git a/Rx.NET/Source/src/Microsoft.Reactive.Testing/TestScheduler.cs b/Rx.NET/Source/src/Microsoft.Reactive.Testing/TestScheduler.cs index 8bd795632a..82994a9149 100644 --- a/Rx.NET/Source/src/Microsoft.Reactive.Testing/TestScheduler.cs +++ b/Rx.NET/Source/src/Microsoft.Reactive.Testing/TestScheduler.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.Diagnostics; using System.Reactive; using System.Reactive.Concurrency; using System.Reactive.Disposables; @@ -12,6 +13,10 @@ namespace Microsoft.Reactive.Testing /// /// Virtual time scheduler used for testing applications and libraries built using Reactive Extensions. /// + [DebuggerDisplay("\\{ " + + nameof(Clock) + " = {" + nameof(Clock) + "} " + + nameof(Now) + " = {" + nameof(Now) + ".ToString(\"O\")} " + + "\\}")] public class TestScheduler : VirtualTimeScheduler { /// diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/HistoricalScheduler.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/HistoricalScheduler.cs index e14e2806a2..9919f7b6e9 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/HistoricalScheduler.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/HistoricalScheduler.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; +using System.Diagnostics; namespace System.Reactive.Concurrency { @@ -67,6 +68,10 @@ protected override DateTimeOffset Add(DateTimeOffset absolute, TimeSpan relative /// /// Provides a virtual time scheduler that uses for absolute time and for relative time. /// + [DebuggerDisplay("\\{ " + + nameof(Clock) + " = {" + nameof(Clock) + "} " + + nameof(Now) + " = {" + nameof(Now) + ".ToString(\"O\")} " + + "\\}")] public class HistoricalScheduler : HistoricalSchedulerBase { private readonly SchedulerQueue _queue = new SchedulerQueue(); diff --git a/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Core.approved.txt b/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Core.approved.txt index 3c723b219b..a6477c99f0 100644 --- a/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Core.approved.txt +++ b/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Core.approved.txt @@ -267,6 +267,7 @@ namespace System.Reactive.Concurrency public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { } public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { } } + [System.Diagnostics.DebuggerDisplayAttribute("\\{ Clock = {Clock} Now = {Now.ToString(\"O\")} \\}")] public class HistoricalScheduler : System.Reactive.Concurrency.HistoricalSchedulerBase { public HistoricalScheduler() { } diff --git a/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Testing.approved.txt b/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Testing.approved.txt index 52015e4216..d6b262a213 100644 --- a/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Testing.approved.txt +++ b/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Testing.approved.txt @@ -71,6 +71,7 @@ namespace Microsoft.Reactive.Testing public override int GetHashCode() { } public override string ToString() { } } + [System.Diagnostics.DebuggerDisplayAttribute("\\{ Clock = {Clock} Now = {Now.ToString(\"O\")} \\}")] public class TestScheduler : System.Reactive.Concurrency.VirtualTimeScheduler { public TestScheduler() { }