Skip to content

Commit

Permalink
Merge pull request #809 from paulomorgado/scheduler-debugger-display
Browse files Browse the repository at this point in the history
Added debugger display information to TestScheduler and HistoricalScheduler
  • Loading branch information
danielcweber authored Sep 17, 2018
2 parents 5f9df73 + 72c3b7d commit 65be066
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Rx.NET/Source/src/Microsoft.Reactive.Testing/TestScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -12,6 +13,10 @@ namespace Microsoft.Reactive.Testing
/// <summary>
/// Virtual time scheduler used for testing applications and libraries built using Reactive Extensions.
/// </summary>
[DebuggerDisplay("\\{ " +
nameof(Clock) + " = {" + nameof(Clock) + "} " +
nameof(Now) + " = {" + nameof(Now) + ".ToString(\"O\")} " +
"\\}")]
public class TestScheduler : VirtualTimeScheduler<long, long>
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -67,6 +68,10 @@ protected override DateTimeOffset Add(DateTimeOffset absolute, TimeSpan relative
/// <summary>
/// Provides a virtual time scheduler that uses <see cref="DateTimeOffset"/> for absolute time and <see cref="TimeSpan"/> for relative time.
/// </summary>
[DebuggerDisplay("\\{ " +
nameof(Clock) + " = {" + nameof(Clock) + "} " +
nameof(Now) + " = {" + nameof(Now) + ".ToString(\"O\")} " +
"\\}")]
public class HistoricalScheduler : HistoricalSchedulerBase
{
private readonly SchedulerQueue<DateTimeOffset> _queue = new SchedulerQueue<DateTimeOffset>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ namespace System.Reactive.Concurrency
public System.IDisposable SchedulePeriodic<TState>(TState state, System.TimeSpan period, System.Func<TState, TState> 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() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<long, long>
{
public TestScheduler() { }
Expand Down

0 comments on commit 65be066

Please sign in to comment.