private static TraceSource GetTraceSource(IClockable <long> clock, Action <long, string> onMessage) { var trace = new TraceSource("Tests_" + Guid.NewGuid().ToString(), SourceLevels.All); trace.Listeners.Add(new MyListener(clock, onMessage)); return(trace); }
private static TestLogger GetTraceSource(IClockable <long> clock) { var res = new List <Recorded <LogEntry> >(); var trace = GetTraceSource(clock, (time, message) => res.Add(new Recorded <LogEntry>(time, new LogEntry(message)))); return(new TestLogger(res, trace)); }
public MyListener(IClockable <long> clock, Action <long, string> onMessage) { _clock = clock; _onMessage = onMessage; _buffer = new List <string>(); }
protected MockSubscribable(IClockable <long> clock) { Clock = clock ?? throw new ArgumentNullException(nameof(clock)); Subscriptions = new List <Subscription>(); TheObserver = NopObserver <T> .Instance; }