コード例 #1
0
        public void RecordWithDebugSessionId()
        {
            const string DebugSessionId1 = "abc123";
            const string DebugSessionId2 = "def456";

            metrics.NewDebugSessionId().Returns(DebugSessionId1);

            debugSessionMetrics.UseNewDebugSessionId();
            Assert.AreEqual(DebugSessionId1, debugSessionMetrics.DebugSessionId);
            debugSessionMetrics.RecordEvent(EventType, logEvent);
            logEvent.DebugSessionIdStr = DebugSessionId1;
            metrics.Received(1).RecordEvent(EventType, logEvent);

            metrics.ClearReceivedCalls();

            debugSessionMetrics.DebugSessionId = DebugSessionId2;
            debugSessionMetrics.RecordEvent(EventType, logEvent);
            logEvent.DebugSessionIdStr = DebugSessionId2;
            metrics.Received(1).RecordEvent(EventType, logEvent);
        }