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
1 change: 0 additions & 1 deletion Feature.Flags.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<DefineConstants Condition="'$(IS_NET6_OR_7)' == '1'">$(DefineConstants);FEATURE_RANDOM_ADVANCED</DefineConstants>
<DefineConstants Condition="'$(IS_NET6_OR_7)' == '1'">$(DefineConstants);FEATURE_FILESYSTEMWATCHER_ADVANCED</DefineConstants>
<DefineConstants Condition="'$(IS_NET6_OR_7)' == '1'">$(DefineConstants);FEATURE_EXCEPTION_HRESULT</DefineConstants>
<DefineConstants Condition="'$(IS_NET6_OR_7)' == '1'">$(DefineConstants);FEATURE_TIMER_COUNT</DefineConstants>
<DefineConstants Condition="'$(IS_NET7)' == '1'">$(DefineConstants);FEATURE_ZIPFILE_NET7</DefineConstants>
<DefineConstants Condition="'$(IS_NET7)' == '1'">$(DefineConstants);FEATURE_FILESYSTEM_NET7</DefineConstants>
<DefineConstants Condition="'$(IS_NET7)' == '1'">$(DefineConstants);FEATURE_FILESYSTEM_SAFEFILEHANDLE</DefineConstants>
Expand Down
5 changes: 0 additions & 5 deletions Source/Testably.Abstractions.Interface/ITimeSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,4 @@ public interface ITimeSystem
/// Abstractions for <see cref="System.Threading.Thread" />.
/// </summary>
IThread Thread { get; }

/// <summary>
/// Abstractions for <see cref="System.Threading.Timer" />.
/// </summary>
ITimerFactory Timer { get; }
}
25 changes: 0 additions & 25 deletions Source/Testably.Abstractions.Interface/TimeSystem/ITimer.cs

This file was deleted.

32 changes: 0 additions & 32 deletions Source/Testably.Abstractions.Interface/TimeSystem/ITimerFactory.cs

This file was deleted.

12 changes: 0 additions & 12 deletions Source/Testably.Abstractions.Testing/Helpers/ExceptionFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ public static NotSupportedException NotSupportedSafeFileHandle()
=> new(
"You cannot mock a safe file handle in the mocked file system without registering a strategy explicitly. Use `MockFileSystem.WithSafeFileHandleStrategy`!");

public static NotSupportedException NotSupportedTimerWrapping()
=> new("You cannot wrap an existing Timer in the MockTimeSystem instance!");

public static ArgumentException SearchPatternCannotContainTwoDots()
=> new(
"Search pattern cannot contain \"..\" to move up directories and can be contained only internally in file/directory names, as in \"a..b\".");
Expand Down Expand Up @@ -241,15 +238,6 @@ internal static PlatformNotSupportedException UnixFileModeNotSupportedOnThisPlat
{
#if FEATURE_EXCEPTION_HRESULT
HResult = -2146233031
#endif
};

public static ArgumentOutOfRangeException TimerArgumentOutOfRange(string propertyName)
=> new(propertyName,
"Number must be either non-negative and less than or equal to Int32.MaxValue or -1")
{
#if FEATURE_EXCEPTION_HRESULT
HResult = -2146233086
#endif
};
}
21 changes: 0 additions & 21 deletions Source/Testably.Abstractions.Testing/MockTimeSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,10 @@ public INotificationHandler On
/// </summary>
public ITimeProvider TimeProvider { get; }

/// <summary>
/// The handler for mocked timers.
/// </summary>
public ITimerHandler TimerHandler => _timerMock;

private readonly NotificationHandler _callbackHandler;
private readonly DateTimeMock _dateTimeMock;
private readonly TaskMock _taskMock;
private readonly ThreadMock _threadMock;
private readonly TimerFactoryMock _timerMock;

/// <summary>
/// Initializes the <see cref="MockTimeSystem" /> with a random time.
Expand All @@ -57,7 +51,6 @@ public MockTimeSystem(ITimeProvider timeProvider)
_dateTimeMock = new DateTimeMock(this, _callbackHandler);
_threadMock = new ThreadMock(this, _callbackHandler);
_taskMock = new TaskMock(this, _callbackHandler);
_timerMock = new TimerFactoryMock(this, _callbackHandler);
}

#region ITimeSystem Members
Expand All @@ -74,19 +67,5 @@ public ITask Task
public IThread Thread
=> _threadMock;

/// <inheritdoc cref="ITimeSystem.Timer" />
public ITimerFactory Timer
=> _timerMock;

#endregion

/// <summary>
/// Specifies the <see cref="ITimerStrategy" /> to use when dealing with timers.
/// </summary>
/// <param name="timerStrategy">The timer strategy. </param>
public MockTimeSystem WithTimerStrategy(ITimerStrategy timerStrategy)
{
_timerMock.SetTimerStrategy(timerStrategy);
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,4 @@ Notification.IAwaitableCallback<TimeSpan> TaskDelay(
Notification.IAwaitableCallback<TimeSpan> ThreadSleep(
Action<TimeSpan>? callback = null,
Func<TimeSpan, bool>? predicate = null);

/// <summary>
/// Callback executed when a timer callback was executed.
/// </summary>
/// <param name="callback">The callback to execute after the <c>Thread.Sleep</c> was called.</param>
/// <param name="predicate">
/// (optional) A predicate used to filter which callbacks should be notified.<br />
/// If set to <see langword="null" /> (default value) all callbacks are notified.
/// </param>
/// <returns>An <see cref="Notification.IAwaitableCallback{TimeSpan}" /> to un-register the callback on dispose.</returns>
Notification.IAwaitableCallback<TimerExecution> TimerExecuted(
Action<TimerExecution>? callback = null,
Func<TimerExecution, bool>? predicate = null);
}
13 changes: 0 additions & 13 deletions Source/Testably.Abstractions.Testing/TimeSystem/ITimerHandler.cs

This file was deleted.

33 changes: 0 additions & 33 deletions Source/Testably.Abstractions.Testing/TimeSystem/ITimerMock.cs

This file was deleted.

22 changes: 0 additions & 22 deletions Source/Testably.Abstractions.Testing/TimeSystem/ITimerStrategy.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ private readonly Notification.INotificationFactory<TimeSpan>
private readonly Notification.INotificationFactory<TimeSpan>
_threadSleepCallbacks = Notification.CreateFactory<TimeSpan>();

private readonly Notification.INotificationFactory<TimerExecution>
_timerExecutedCallbacks = Notification.CreateFactory<TimerExecution>();

#region INotificationHandler Members

/// <inheritdoc cref="INotificationHandler.DateTimeRead(Action{DateTime}?, Func{DateTime, bool}?)" />
Expand All @@ -36,12 +33,6 @@ public Notification.IAwaitableCallback<TimeSpan> ThreadSleep(
Func<TimeSpan, bool>? predicate = null)
=> _threadSleepCallbacks.RegisterCallback(callback, predicate);

/// <inheritdoc cref="INotificationHandler.TimerExecuted(Action{TimerExecution}?, Func{TimerExecution, bool}?)" />
public Notification.IAwaitableCallback<TimerExecution> TimerExecuted(
Action<TimerExecution>? callback = null,
Func<TimerExecution, bool>? predicate = null)
=> _timerExecutedCallbacks.RegisterCallback(callback, predicate);

#endregion

public void InvokeDateTimeReadCallbacks(DateTime now)
Expand All @@ -52,7 +43,4 @@ public void InvokeTaskDelayCallbacks(TimeSpan delay)

public void InvokeThreadSleepCallbacks(TimeSpan timeout)
=> _threadSleepCallbacks.InvokeCallbacks(timeout);

public void InvokeTimerExecutedCallbacks(TimerExecution timerExecution)
=> _timerExecutedCallbacks.InvokeCallbacks(timerExecution);
}
38 changes: 0 additions & 38 deletions Source/Testably.Abstractions.Testing/TimeSystem/TimerExecution.cs

This file was deleted.

Loading