示例#1
0
        public void BackgroundThreadMethodShouldNotOccurBeforeAnyPreceedingSyncMethods()
        {
            var expectedTraceTree = ExpectedTransactionTraceSegment.NewTree(ClassName, "RootMethod",
                                                                            ExpectedTransactionTraceSegment.NewSubtree("MetricNameRoot", ClassName, "RootMethod",
                                                                                                                       ExpectedTransactionTraceSegment.NewBackgroundThreadSubtree("MetricName1", ClassName, "Method1",
                                                                                                                                                                                  ExpectedTransactionTraceSegment.NewSubtree("MetricName11", ClassName, "Method11"),
                                                                                                                                                                                  ExpectedTransactionTraceSegment.NewSubtree("MetricName12", ClassName, "Method12")
                                                                                                                                                                                  ),
                                                                                                                       ExpectedTransactionTraceSegment.NewSubtree("MetricName2", ClassName, "Method2",
                                                                                                                                                                  ExpectedTransactionTraceSegment.NewSubtree("MetricName21", ClassName, "Method21"),
                                                                                                                                                                  ExpectedTransactionTraceSegment.NewSubtree("MetricName22", ClassName, "Method22")
                                                                                                                                                                  ),
                                                                                                                       // Method3 should not occur before synchronous Method2 in a transaction trace
                                                                                                                       ExpectedTransactionTraceSegment.NewBackgroundThreadSubtree("MetricName3", ClassName, "Method3",
                                                                                                                                                                                  ExpectedTransactionTraceSegment.NewSubtree("MetricName31", ClassName, "Method31"),
                                                                                                                                                                                  ExpectedTransactionTraceSegment.NewSubtree("MetricName32", ClassName, "Method32")
                                                                                                                                                                                  )
                                                                                                                       )
                                                                            );

            var actualTraceTree = TestTransactionTraceSegment.NewTree(ClassName, "RootMethod",
                                                                      TestTransactionTraceSegment.NewSubtree("MetricNameRoot", ClassName, "RootMethod",
                                                                                                             TestTransactionTraceSegment.NewSubtree("MetricName3", ClassName, "Method3",
                                                                                                                                                    TestTransactionTraceSegment.NewSubtree("MetricName31", ClassName, "Method31"),
                                                                                                                                                    TestTransactionTraceSegment.NewSubtree("MetricName32", ClassName, "Method32")
                                                                                                                                                    ),
                                                                                                             TestTransactionTraceSegment.NewSubtree("MetricName2", ClassName, "Method2",
                                                                                                                                                    TestTransactionTraceSegment.NewSubtree("MetricName21", ClassName, "Method21"),
                                                                                                                                                    TestTransactionTraceSegment.NewSubtree("MetricName22", ClassName, "Method22")
                                                                                                                                                    ),
                                                                                                             TestTransactionTraceSegment.NewSubtree("MetricName1", ClassName, "Method1",
                                                                                                                                                    TestTransactionTraceSegment.NewSubtree("MetricName11", ClassName, "Method11"),
                                                                                                                                                    TestTransactionTraceSegment.NewSubtree("MetricName12", ClassName, "Method12")
                                                                                                                                                    )
                                                                                                             )
                                                                      );

            var result = expectedTraceTree.CompareToActualTransactionTrace(actualTraceTree);

            Assert.False(result.IsEquivalent, result.Diff);
        }
示例#2
0
        public void BackgroundThreadMethodOrderingMayNotMatter()
        {
            var expectedTraceTree = ExpectedTransactionTraceSegment.NewTree(ClassName, "RootMethod",
                                                                            ExpectedTransactionTraceSegment.NewSubtree("MetricNameRoot", ClassName, "RootMethod",
                                                                                                                       ExpectedTransactionTraceSegment.NewBackgroundThreadSubtree("MetricName1", ClassName, "Method1",
                                                                                                                                                                                  ExpectedTransactionTraceSegment.NewSubtree("MetricName11", ClassName, "Method11"),
                                                                                                                                                                                  ExpectedTransactionTraceSegment.NewSubtree("MetricName12", ClassName, "Method12")
                                                                                                                                                                                  ),
                                                                                                                       ExpectedTransactionTraceSegment.NewBackgroundThreadSubtree("MetricName2", ClassName, "Method2",
                                                                                                                                                                                  ExpectedTransactionTraceSegment.NewSubtree("MetricName21", ClassName, "Method21"),
                                                                                                                                                                                  ExpectedTransactionTraceSegment.NewSubtree("MetricName22", ClassName, "Method22")
                                                                                                                                                                                  ),
                                                                                                                       ExpectedTransactionTraceSegment.NewBackgroundThreadSubtree("MetricName3", ClassName, "Method3",
                                                                                                                                                                                  ExpectedTransactionTraceSegment.NewSubtree("MetricName31", ClassName, "Method31"),
                                                                                                                                                                                  ExpectedTransactionTraceSegment.NewSubtree("MetricName32", ClassName, "Method32")
                                                                                                                                                                                  )
                                                                                                                       )
                                                                            );

            var actualTraceTree = TestTransactionTraceSegment.NewTree(ClassName, "RootMethod",
                                                                      TestTransactionTraceSegment.NewSubtree("MetricNameRoot", ClassName, "RootMethod",
                                                                                                             TestTransactionTraceSegment.NewSubtree("MetricName3", ClassName, "Method3",
                                                                                                                                                    TestTransactionTraceSegment.NewSubtree("MetricName31", ClassName, "Method31"),
                                                                                                                                                    TestTransactionTraceSegment.NewSubtree("MetricName32", ClassName, "Method32")
                                                                                                                                                    ),
                                                                                                             TestTransactionTraceSegment.NewSubtree("MetricName2", ClassName, "Method2",
                                                                                                                                                    TestTransactionTraceSegment.NewSubtree("MetricName21", ClassName, "Method21"),
                                                                                                                                                    TestTransactionTraceSegment.NewSubtree("MetricName22", ClassName, "Method22")
                                                                                                                                                    ),
                                                                                                             TestTransactionTraceSegment.NewSubtree("MetricName1", ClassName, "Method1",
                                                                                                                                                    TestTransactionTraceSegment.NewSubtree("MetricName11", ClassName, "Method11"),
                                                                                                                                                    TestTransactionTraceSegment.NewSubtree("MetricName12", ClassName, "Method12")
                                                                                                                                                    )
                                                                                                             )
                                                                      );

            var result = expectedTraceTree.CompareToActualTransactionTrace(actualTraceTree);

            Assert.True(result.IsEquivalent, result.Diff);
        }
示例#3
0
        public void ShouldEnsureCorrectIdenticalBackgroundThreadSubtreeCount()
        {
            var expectedTraceTree = ExpectedTransactionTraceSegment.NewTree(ClassName, "RootMethod",
                                                                            ExpectedTransactionTraceSegment.NewSubtree("MetricNameRoot", ClassName, "RootMethod",
                                                                                                                       ExpectedTransactionTraceSegment.NewBackgroundThreadSubtree("MetricName1", ClassName, "Method1",
                                                                                                                                                                                  ExpectedTransactionTraceSegment.NewSubtree("MetricName11", ClassName, "Method11"),
                                                                                                                                                                                  ExpectedTransactionTraceSegment.NewSubtree("MetricName12", ClassName, "Method12")
                                                                                                                                                                                  ),
                                                                                                                       ExpectedTransactionTraceSegment.NewBackgroundThreadSubtree("MetricName1", ClassName, "Method1",
                                                                                                                                                                                  ExpectedTransactionTraceSegment.NewSubtree("MetricName11", ClassName, "Method11"),
                                                                                                                                                                                  ExpectedTransactionTraceSegment.NewSubtree("MetricName12", ClassName, "Method12")
                                                                                                                                                                                  ),
                                                                                                                       ExpectedTransactionTraceSegment.NewSubtree("MetricName2", ClassName, "Method2",
                                                                                                                                                                  ExpectedTransactionTraceSegment.NewSubtree("MetricName21", ClassName, "Method21"),
                                                                                                                                                                  ExpectedTransactionTraceSegment.NewSubtree("MetricName22", ClassName, "Method22")
                                                                                                                                                                  )
                                                                                                                       )
                                                                            );

            var actualTraceTree = TestTransactionTraceSegment.NewTree(ClassName, "RootMethod",
                                                                      TestTransactionTraceSegment.NewSubtree("MetricNameRoot", ClassName, "RootMethod",
                                                                                                             TestTransactionTraceSegment.NewSubtree("MetricName1", ClassName, "Method1",
                                                                                                                                                    TestTransactionTraceSegment.NewSubtree("MetricName11", ClassName, "Method11"),
                                                                                                                                                    TestTransactionTraceSegment.NewSubtree("MetricName12", ClassName, "Method12")
                                                                                                                                                    ),
                                                                                                             TestTransactionTraceSegment.NewSubtree("MetricName2", ClassName, "Method2",
                                                                                                                                                    TestTransactionTraceSegment.NewSubtree("MetricName21", ClassName, "Method21"),
                                                                                                                                                    TestTransactionTraceSegment.NewSubtree("MetricName22", ClassName, "Method22")
                                                                                                                                                    )
                                                                                                             )
                                                                      );

            var result = expectedTraceTree.CompareToActualTransactionTrace(actualTraceTree);

            Assert.False(result.IsEquivalent, result.Diff);
        }