Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Source/Testably.Abstractions.Testing/IAwaitableCallback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ public interface IAwaitableCallback<TValue> : IDisposable
/// <param name="executeWhenWaiting">
/// (optional) A callback to execute when waiting started.
/// </param>
#if MarkExecuteWhileWaitingNotificationObsolete
[Obsolete("Use another `Wait` or `WaitAsync` overload and move the filter to the creation of the awaitable callback.")]
#endif
void Wait(Func<TValue, bool>? filter = null,
void Wait(Func<TValue, bool>? filter,
int timeout = 30000,
int count = 1,
Action? executeWhenWaiting = null);
Expand All @@ -54,7 +52,7 @@ void Wait(Func<TValue, bool>? filter = null,
/// (optional) The timeout to wait on the callback.<br />
/// If not specified (<see langword="null" />), defaults to 30 seconds.
/// </param>
TValue[] Wait(int count, TimeSpan? timeout = null);
TValue[] Wait(int count = 1, TimeSpan? timeout = null);

/// <summary>
/// Waits asynchronously until the callback is executed.
Expand Down
2 changes: 0 additions & 2 deletions Source/Testably.Abstractions.Testing/MockTimeSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ public MockTimeSystem(DateTime time, Func<MockTimeSystemOptions, MockTimeSystemO
/// <summary>
/// Initializes the <see cref="MockTimeSystem" /> with the specified <paramref name="timeProvider" />.
/// </summary>
#if MarkExecuteWhileWaitingNotificationObsolete
[Obsolete("Use the constructor with ITimeProviderFactory instead.")]
#endif
public MockTimeSystem(ITimeProvider timeProvider) : this(
new TimeProvider.Factory(_ => timeProvider))
{
Expand Down
23 changes: 6 additions & 17 deletions Source/Testably.Abstractions.Testing/Notification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ public static class Notification
/// Executes the <paramref name="callback" /> while waiting for the notification.
/// </summary>
/// <returns>The <paramref name="awaitable" /> callback.</returns>
#if MarkExecuteWhileWaitingNotificationObsolete
[Obsolete("Execute the callback before calling `Wait` or `WaitAsync` instead.")]
#endif
public static IAwaitableCallback<TValue> ExecuteWhileWaiting<TValue>(
this IAwaitableCallback<TValue> awaitable, Action callback)
{
Expand All @@ -34,9 +32,7 @@ public static IAwaitableCallback<TValue> ExecuteWhileWaiting<TValue>(
/// Executes the <paramref name="callback" /> while waiting for the notification.
/// </summary>
/// <returns>The <paramref name="awaitable" /> callback.</returns>
#if MarkExecuteWhileWaitingNotificationObsolete
[Obsolete("Execute the callback before calling `Wait` or `WaitAsync` instead.")]
#endif
public static IAwaitableCallback<TValue, TFunc> ExecuteWhileWaiting<TValue, TFunc>(
this IAwaitableCallback<TValue> awaitable, Func<TFunc> callback)
{
Expand Down Expand Up @@ -117,7 +113,7 @@ public void Dispose()
}

/// <inheritdoc cref="IAwaitableCallback{TValue}.Wait(Func{TValue, bool}?, int, int, Action?)" />
public void Wait(Func<TValue, bool>? filter = null,
public void Wait(Func<TValue, bool>? filter,
int timeout = 30000,
int count = 1,
Action? executeWhenWaiting = null)
Expand Down Expand Up @@ -159,7 +155,7 @@ public void Wait(Func<TValue, bool>? filter = null,
}

/// <inheritdoc />
public TValue[] Wait(int count, TimeSpan? timeout = null)
public TValue[] Wait(int count = 1, TimeSpan? timeout = null)
{
if (_isDisposed)
{
Expand Down Expand Up @@ -276,9 +272,7 @@ IAwaitableCallback<TValue> RegisterCallback(
/// - un-registering a callback by calling <see cref="IDisposable.Dispose()" /><br />
/// - blocking for the callback to be executed
/// </summary>
#if MarkExecuteWhileWaitingNotificationObsolete
[Obsolete("Will be removed when `ExecuteWhileWaiting` is removed.")]
#endif
public interface IAwaitableCallback<TValue, out TFunc>
: IAwaitableCallback<TValue>
{
Expand All @@ -305,15 +299,13 @@ public interface IAwaitableCallback<TValue, out TFunc>
/// <param name="executeWhenWaiting">
/// (optional) A callback to execute when waiting started.
/// </param>
new TFunc Wait(Func<TValue, bool>? filter = null,
new TFunc Wait(Func<TValue, bool>? filter,
int timeout = 30000,
int count = 1,
Action? executeWhenWaiting = null);
}

#if MarkExecuteWhileWaitingNotificationObsolete
[Obsolete("Will be removed when `ExecuteWhileWaiting` is removed.")]
#endif
private sealed class CallbackWaiterWithValue<TValue, TFunc>
: IAwaitableCallback<TValue, TFunc>
{
Expand All @@ -334,11 +326,8 @@ public void Dispose()
=> _awaitableCallback.Dispose();

/// <inheritdoc cref="IAwaitableCallback{TValue, TFunc}.Wait(Func{TValue, bool}?,int,int, Action?)" />
#if MarkExecuteWhileWaitingNotificationObsolete
[Obsolete(
"Use another `Wait` or `WaitAsync` overload and move the filter to the creation of the awaitable callback.")]
#endif
public TFunc Wait(Func<TValue, bool>? filter = null,
[Obsolete("Use another `Wait` or `WaitAsync` overload and move the filter to the creation of the awaitable callback.")]
public TFunc Wait(Func<TValue, bool>? filter,
int timeout = 30000,
int count = 1,
Action? executeWhenWaiting = null)
Expand All @@ -353,7 +342,7 @@ public TFunc Wait(Func<TValue, bool>? filter = null,
}

/// <inheritdoc />
public TValue[] Wait(int count, TimeSpan? timeout = null)
public TValue[] Wait(int count = 1, TimeSpan? timeout = null)
{
_valueProvider();
return _awaitableCallback.Wait(count, timeout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ namespace Testably.Abstractions.Testing
}
public interface IAwaitableCallback<TValue> : System.IDisposable
{
TValue[] Wait(int count, System.TimeSpan? timeout = default);
void Wait(System.Func<TValue, bool>? filter = null, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null);
TValue[] Wait(int count = 1, System.TimeSpan? timeout = default);
[System.Obsolete("Use another `Wait` or `WaitAsync` overload and move the filter to the creation of" +
" the awaitable callback.")]
void Wait(System.Func<TValue, bool>? filter, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null);
System.Threading.Tasks.Task<TValue[]> WaitAsync(int count = 1, System.TimeSpan? timeout = default, System.Threading.CancellationToken? cancellationToken = default);
}
public static class InterceptionHandlerExtensions
Expand Down Expand Up @@ -103,6 +105,7 @@ namespace Testably.Abstractions.Testing
public MockTimeSystem() { }
public MockTimeSystem(System.DateTime time) { }
public MockTimeSystem(System.Func<Testably.Abstractions.Testing.MockTimeSystem.MockTimeSystemOptions, Testably.Abstractions.Testing.MockTimeSystem.MockTimeSystemOptions> options) { }
[System.Obsolete("Use the constructor with ITimeProviderFactory instead.")]
public MockTimeSystem(Testably.Abstractions.Testing.TimeSystem.ITimeProvider timeProvider) { }
public MockTimeSystem(Testably.Abstractions.Testing.TimeSystem.ITimeProviderFactory timeProvider) { }
public MockTimeSystem(System.DateTime time, System.Func<Testably.Abstractions.Testing.MockTimeSystem.MockTimeSystemOptions, Testably.Abstractions.Testing.MockTimeSystem.MockTimeSystemOptions> options) { }
Expand All @@ -126,11 +129,14 @@ namespace Testably.Abstractions.Testing
}
public static class Notification
{
[System.Obsolete("Execute the callback before calling `Wait` or `WaitAsync` instead.")]
public static Testably.Abstractions.Testing.IAwaitableCallback<TValue> ExecuteWhileWaiting<TValue>(this Testably.Abstractions.Testing.IAwaitableCallback<TValue> awaitable, System.Action callback) { }
[System.Obsolete("Execute the callback before calling `Wait` or `WaitAsync` instead.")]
public static Testably.Abstractions.Testing.Notification.IAwaitableCallback<TValue, TFunc> ExecuteWhileWaiting<TValue, TFunc>(this Testably.Abstractions.Testing.IAwaitableCallback<TValue> awaitable, System.Func<TFunc> callback) { }
[System.Obsolete("Will be removed when `ExecuteWhileWaiting` is removed.")]
public interface IAwaitableCallback<TValue, out TFunc> : System.IDisposable, Testably.Abstractions.Testing.IAwaitableCallback<TValue>
{
TFunc Wait(System.Func<TValue, bool>? filter = null, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null);
TFunc Wait(System.Func<TValue, bool>? filter, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null);
}
}
public static class NotificationHandlerExtensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ namespace Testably.Abstractions.Testing
}
public interface IAwaitableCallback<TValue> : System.IDisposable
{
TValue[] Wait(int count, System.TimeSpan? timeout = default);
void Wait(System.Func<TValue, bool>? filter = null, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null);
TValue[] Wait(int count = 1, System.TimeSpan? timeout = default);
[System.Obsolete("Use another `Wait` or `WaitAsync` overload and move the filter to the creation of" +
" the awaitable callback.")]
void Wait(System.Func<TValue, bool>? filter, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null);
System.Threading.Tasks.Task<TValue[]> WaitAsync(int count = 1, System.TimeSpan? timeout = default, System.Threading.CancellationToken? cancellationToken = default);
}
public static class InterceptionHandlerExtensions
Expand Down Expand Up @@ -102,6 +104,7 @@ namespace Testably.Abstractions.Testing
public MockTimeSystem() { }
public MockTimeSystem(System.DateTime time) { }
public MockTimeSystem(System.Func<Testably.Abstractions.Testing.MockTimeSystem.MockTimeSystemOptions, Testably.Abstractions.Testing.MockTimeSystem.MockTimeSystemOptions> options) { }
[System.Obsolete("Use the constructor with ITimeProviderFactory instead.")]
public MockTimeSystem(Testably.Abstractions.Testing.TimeSystem.ITimeProvider timeProvider) { }
public MockTimeSystem(Testably.Abstractions.Testing.TimeSystem.ITimeProviderFactory timeProvider) { }
public MockTimeSystem(System.DateTime time, System.Func<Testably.Abstractions.Testing.MockTimeSystem.MockTimeSystemOptions, Testably.Abstractions.Testing.MockTimeSystem.MockTimeSystemOptions> options) { }
Expand All @@ -124,11 +127,14 @@ namespace Testably.Abstractions.Testing
}
public static class Notification
{
[System.Obsolete("Execute the callback before calling `Wait` or `WaitAsync` instead.")]
public static Testably.Abstractions.Testing.IAwaitableCallback<TValue> ExecuteWhileWaiting<TValue>(this Testably.Abstractions.Testing.IAwaitableCallback<TValue> awaitable, System.Action callback) { }
[System.Obsolete("Execute the callback before calling `Wait` or `WaitAsync` instead.")]
public static Testably.Abstractions.Testing.Notification.IAwaitableCallback<TValue, TFunc> ExecuteWhileWaiting<TValue, TFunc>(this Testably.Abstractions.Testing.IAwaitableCallback<TValue> awaitable, System.Func<TFunc> callback) { }
[System.Obsolete("Will be removed when `ExecuteWhileWaiting` is removed.")]
public interface IAwaitableCallback<TValue, out TFunc> : System.IDisposable, Testably.Abstractions.Testing.IAwaitableCallback<TValue>
{
TFunc Wait(System.Func<TValue, bool>? filter = null, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null);
TFunc Wait(System.Func<TValue, bool>? filter, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null);
}
}
public static class NotificationHandlerExtensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ namespace Testably.Abstractions.Testing
}
public interface IAwaitableCallback<TValue> : System.IDisposable
{
TValue[] Wait(int count, System.TimeSpan? timeout = default);
void Wait(System.Func<TValue, bool>? filter = null, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null);
TValue[] Wait(int count = 1, System.TimeSpan? timeout = default);
[System.Obsolete("Use another `Wait` or `WaitAsync` overload and move the filter to the creation of" +
" the awaitable callback.")]
void Wait(System.Func<TValue, bool>? filter, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null);
System.Threading.Tasks.Task<TValue[]> WaitAsync(int count = 1, System.TimeSpan? timeout = default, System.Threading.CancellationToken? cancellationToken = default);
}
public static class InterceptionHandlerExtensions
Expand Down Expand Up @@ -103,6 +105,7 @@ namespace Testably.Abstractions.Testing
public MockTimeSystem() { }
public MockTimeSystem(System.DateTime time) { }
public MockTimeSystem(System.Func<Testably.Abstractions.Testing.MockTimeSystem.MockTimeSystemOptions, Testably.Abstractions.Testing.MockTimeSystem.MockTimeSystemOptions> options) { }
[System.Obsolete("Use the constructor with ITimeProviderFactory instead.")]
public MockTimeSystem(Testably.Abstractions.Testing.TimeSystem.ITimeProvider timeProvider) { }
public MockTimeSystem(Testably.Abstractions.Testing.TimeSystem.ITimeProviderFactory timeProvider) { }
public MockTimeSystem(System.DateTime time, System.Func<Testably.Abstractions.Testing.MockTimeSystem.MockTimeSystemOptions, Testably.Abstractions.Testing.MockTimeSystem.MockTimeSystemOptions> options) { }
Expand All @@ -126,11 +129,14 @@ namespace Testably.Abstractions.Testing
}
public static class Notification
{
[System.Obsolete("Execute the callback before calling `Wait` or `WaitAsync` instead.")]
public static Testably.Abstractions.Testing.IAwaitableCallback<TValue> ExecuteWhileWaiting<TValue>(this Testably.Abstractions.Testing.IAwaitableCallback<TValue> awaitable, System.Action callback) { }
[System.Obsolete("Execute the callback before calling `Wait` or `WaitAsync` instead.")]
public static Testably.Abstractions.Testing.Notification.IAwaitableCallback<TValue, TFunc> ExecuteWhileWaiting<TValue, TFunc>(this Testably.Abstractions.Testing.IAwaitableCallback<TValue> awaitable, System.Func<TFunc> callback) { }
[System.Obsolete("Will be removed when `ExecuteWhileWaiting` is removed.")]
public interface IAwaitableCallback<TValue, out TFunc> : System.IDisposable, Testably.Abstractions.Testing.IAwaitableCallback<TValue>
{
TFunc Wait(System.Func<TValue, bool>? filter = null, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null);
TFunc Wait(System.Func<TValue, bool>? filter, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null);
}
}
public static class NotificationHandlerExtensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ namespace Testably.Abstractions.Testing
}
public interface IAwaitableCallback<TValue> : System.IDisposable
{
TValue[] Wait(int count, System.TimeSpan? timeout = default);
void Wait(System.Func<TValue, bool>? filter = null, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null);
TValue[] Wait(int count = 1, System.TimeSpan? timeout = default);
[System.Obsolete("Use another `Wait` or `WaitAsync` overload and move the filter to the creation of" +
" the awaitable callback.")]
void Wait(System.Func<TValue, bool>? filter, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null);
System.Threading.Tasks.Task<TValue[]> WaitAsync(int count = 1, System.TimeSpan? timeout = default, System.Threading.CancellationToken? cancellationToken = default);
}
public static class InterceptionHandlerExtensions
Expand Down Expand Up @@ -103,6 +105,7 @@ namespace Testably.Abstractions.Testing
public MockTimeSystem() { }
public MockTimeSystem(System.DateTime time) { }
public MockTimeSystem(System.Func<Testably.Abstractions.Testing.MockTimeSystem.MockTimeSystemOptions, Testably.Abstractions.Testing.MockTimeSystem.MockTimeSystemOptions> options) { }
[System.Obsolete("Use the constructor with ITimeProviderFactory instead.")]
public MockTimeSystem(Testably.Abstractions.Testing.TimeSystem.ITimeProvider timeProvider) { }
public MockTimeSystem(Testably.Abstractions.Testing.TimeSystem.ITimeProviderFactory timeProvider) { }
public MockTimeSystem(System.DateTime time, System.Func<Testably.Abstractions.Testing.MockTimeSystem.MockTimeSystemOptions, Testably.Abstractions.Testing.MockTimeSystem.MockTimeSystemOptions> options) { }
Expand All @@ -126,11 +129,14 @@ namespace Testably.Abstractions.Testing
}
public static class Notification
{
[System.Obsolete("Execute the callback before calling `Wait` or `WaitAsync` instead.")]
public static Testably.Abstractions.Testing.IAwaitableCallback<TValue> ExecuteWhileWaiting<TValue>(this Testably.Abstractions.Testing.IAwaitableCallback<TValue> awaitable, System.Action callback) { }
[System.Obsolete("Execute the callback before calling `Wait` or `WaitAsync` instead.")]
public static Testably.Abstractions.Testing.Notification.IAwaitableCallback<TValue, TFunc> ExecuteWhileWaiting<TValue, TFunc>(this Testably.Abstractions.Testing.IAwaitableCallback<TValue> awaitable, System.Func<TFunc> callback) { }
[System.Obsolete("Will be removed when `ExecuteWhileWaiting` is removed.")]
public interface IAwaitableCallback<TValue, out TFunc> : System.IDisposable, Testably.Abstractions.Testing.IAwaitableCallback<TValue>
{
TFunc Wait(System.Func<TValue, bool>? filter = null, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null);
TFunc Wait(System.Func<TValue, bool>? filter, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null);
}
}
public static class NotificationHandlerExtensions
Expand Down
Loading
Loading