示例#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;
 }