Ejemplo n.º 1
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
        }
Ejemplo n.º 2
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]);
            }
        }
Ejemplo n.º 3
0
        public void TestBasicEmission()
        {
            ConsoleTelemetron ct = new ConsoleTelemetron(CreateDefaultConfiguration());

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

                // we have to use GTE for counte as
                // we dont know how many additional events
                // (we do know how many, but coupling to that number is stupid).
                Assert.IsTrue(harness.Events.Count >= 2);
            }
        }