forked from fluentassertions/fluentassertions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EventMonitorOptions.cs
45 lines (39 loc) · 1.39 KB
/
EventMonitorOptions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Collections.Generic;
namespace FluentAssertions.Events;
/// <summary>
/// Settings for the <see cref="EventMonitor{T}"/>.
/// </summary>
public class EventMonitorOptions
{
/// <summary>
/// Will ignore the events, if they throw an exception on any custom event accessor implementation. default: false.
/// </summary>
internal bool ShouldIgnoreEventAccessorExceptions { get; private set; }
/// <summary>
/// Func used to generate the timestamp.
/// </summary>
internal Func<DateTime> TimestampProvider { get; private set; } = () => DateTime.UtcNow;
/// <summary>
/// When called it will ignore event accessor Exceptions.
/// </summary>
/// <returns>The options instance for method stacking.</returns>
public EventMonitorOptions IgnoreEventAccessorExceptions()
{
ShouldIgnoreEventAccessorExceptions = true;
return this;
}
/// <summary>
/// Sets the timestamp provider. default it is <see cref="DateTime.Now"/>.
/// </summary>
/// <param name="timestampProvider">The timestamp provider.</param>
/// <returns>The options instance for method stacking.</returns>
internal EventMonitorOptions ConfigureTimestampProvider(Func<DateTime> timestampProvider)
{
if (timestampProvider != null)
{
TimestampProvider = timestampProvider;
}
return this;
}
}