Skip to content

Commit 94e365f

Browse files
vbreussvbtig
andauthored
doc: improve documentation in Timers (#271)
Improve errors and missing data in the documentations from the timer implementation from - #270 Co-authored-by: Valentin Breuß <[email protected]>
1 parent 357cf57 commit 94e365f

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

Source/Testably.Abstractions.Testing/TimeSystem/ITimerMock.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public interface ITimerMock : ITimer
1515
/// </summary>
1616
/// <param name="executionCount">The number of execution cycles the thread is blocked.</param>
1717
/// <param name="timeout">
18-
/// The timeout for blocking the current thread.<br />
18+
/// The timeout in milliseconds for blocking the current thread.<br />
1919
/// Throws an <see cref="TimeoutException" /> when the timeout is expired.
2020
/// </param>
2121
/// <param name="callback">
@@ -28,6 +28,7 @@ public interface ITimerMock : ITimer
2828
/// When the <paramref name="timeout" /> expires before the timer is executed
2929
/// <paramref name="executionCount" /> times.
3030
/// </exception>
31-
ITimerMock Wait(int executionCount = 1, int timeout = 10000,
31+
ITimerMock Wait(int executionCount = 1,
32+
int timeout = 10000,
3233
Action<ITimerMock>? callback = null);
3334
}

Source/Testably.Abstractions.Testing/TimeSystem/TimerMock.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public bool Dispose(WaitHandle notifyObject)
152152
e.Set();
153153
break;
154154
default:
155-
throw new NotSupportedException("The wait handle is not of any supported type!");
155+
throw new NotSupportedException($"The wait handle '{nameof(notifyObject)}' is of type '{notifyObject.GetType()}' which is not supported!");
156156
}
157157

158158
return true;
@@ -166,7 +166,7 @@ public ITimerMock Wait(
166166
{
167167
if (executionCount <= 0)
168168
{
169-
throw new ArgumentOutOfRangeException(nameof(executionCount));
169+
throw new ArgumentOutOfRangeException(nameof(executionCount), "Execution count must be greater than zero.");
170170
}
171171

172172
if (timeout < -1)

Source/Testably.Abstractions.Testing/TimeSystem/TimerStrategy.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
public class TimerStrategy : ITimerStrategy
77
{
88
/// <summary>
9-
/// The default time strategy uses <see cref="TimerMode.StartImmediately" />.
9+
/// The default timer strategy uses <see cref="TimerMode.StartImmediately" /> and
10+
/// does not swallow exceptions.
1011
/// </summary>
1112
public static ITimerStrategy Default { get; }
1213
= new TimerStrategy();

0 commit comments

Comments
 (0)