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
        }
Esempio n. 3
0
        public void TestRunOperationVoid()
        {
            using (TraceListenerHarness harness = new TraceListenerHarness(Source))
            {
                var log = Get();

                log.Run(nameof(TestRunOperationVoid), (operation) =>
                {
                });
                //2

                harness.AssertDataAreEqual("OPB/DRz430M", 1, 4);
            }
        }
Esempio n. 4
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);
            }
        }
Esempio n. 5
0
        public void TestRunOperationVoidWithData()
        {
            using (TraceListenerHarness harness = new TraceListenerHarness(Source))
            {
                var log = Get();

                log.Run(nameof(TestRunOperationVoid), (operation) =>
                {
                    operation.TelemetryData["test"] = "Ek588Agn3kM";
                });
                //2

                harness.AssertDataAreEqual("OPB/DRz430M", 1, 4);
            }
        }
Esempio n. 6
0
        public void TestOperationInitNoErrors()
        {
            using (TraceListenerHarness harness = new TraceListenerHarness(Source))
            {
                var log = Get();

                using (IOperation operation = log.CreateOperation("Foo"))
                {
                    log.Info("Bar");
                }

                harness.AssertContains("bar");
                harness.AssertContains("foo");
                harness.AssertNotContains("fatal");
                harness.AssertNotContains("zoolander");
                harness.AssertNotContains("schools for ants.");
            }
        }