예제 #1
0
        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);
        }
예제 #2
0
        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));
        }
예제 #3
0
 public MyListener(IClockable <long> clock, Action <long, string> onMessage)
 {
     _clock     = clock;
     _onMessage = onMessage;
     _buffer    = new List <string>();
 }
예제 #4
0
 protected MockSubscribable(IClockable <long> clock)
 {
     Clock         = clock ?? throw new ArgumentNullException(nameof(clock));
     Subscriptions = new List <Subscription>();
     TheObserver   = NopObserver <T> .Instance;
 }