Beispiel #1
0
        public void Handle_with_ServerHeartbeatSucceededEvent_should_trace_event()
        {
            const string traceSourceName = "Handle_with_ServerHeartbeatSucceededEvent_should_trace_event";
            const string logFileName     = traceSourceName + "-log";
            var          @event          = new ServerHeartbeatSucceededEvent(
                new ConnectionId(new ServerId(new ClusterId(), new IPEndPoint(IPAddress.Parse("1.2.3.4"), 42))),
                new TimeSpan(42));
            var expectedLogMessage =
                $"{TraceSourceEventHelper.Label(@event.ConnectionId)}: sent heartbeat in {@event.Duration.TotalMilliseconds}ms.";
            var traceSource = CreateTraceSource(logFileName, logFileName);
            var subject     = new TraceSourceSdamEventSubscriber(traceSource);

            subject.Handle(@event);
            var log = ReadLog(traceSource, logFileName);

            log.Should().Contain(expectedLogMessage);
        }
 public static void Handle(this TraceSourceSdamEventSubscriber subject, ServerHeartbeatSucceededEvent @event)
 => Reflector.Invoke(subject, "Handle", @event);