Esempio n. 1
0
        public void TestOperationWithCorrenationContext_Depth_3()
        {
            ConsoleTelemetron ct = new ConsoleTelemetron(CreateDefaultConfiguration());

            using (TraceListenerHarness harness = new TraceListenerHarness(Source))
            {
                ct.Info("foo");
                ct.Info("bar");

                string operationIdFirst;
                string operationIdSecond;
                using (IOperation op = ct.CreateOperation("foo"))
                {
                    operationIdFirst = op.OperationId;

                    ct.Info("whee");

                    using (IOperation op2 = ct.CreateOperation("foo"))
                    {
                        operationIdSecond = op.OperationId;

                        ct.Info("whee");
                    }
                }

                var maxDepth = GetMaxCorrelationContextDepth(harness.Events);

                Assert.AreEqual(5, maxDepth[1]);
                Assert.AreEqual(5, maxDepth[2]);
                Assert.AreEqual(2, maxDepth[3]);
            }
        }
Esempio n. 2
0
        public void TestOperationWithCorrenationContext_Depth_2()
        {
            ConsoleTelemetron ct = new ConsoleTelemetron(CreateDefaultConfiguration());

            using (TraceListenerHarness harness = new TraceListenerHarness(Source))
            {
                ct.Info("foo");
                ct.Info("bar");

                string operationId;
                using (IOperation op = ct.CreateOperation("foo"))
                {
                    operationId = op.OperationId;

                    ct.Info("whee");
                }

                //Assert.AreEqual(6, ces.Count);

                var maxDepth = GetMaxCorrelationContextDepth(harness.Events);

                Assert.AreEqual(5, maxDepth[1]);
                Assert.AreEqual(2, maxDepth[2]);
            }

            // events can arrive out of order
        }