Пример #1
0
        public void ProfilingDataRegisterUnRegisterNodesTest()
        {
            //Arrange
            var nodesList = new List <NodeModel>();
            var profiling = new ProfilingData();
            var cbn       = CreateCodeBlockNode();

            //Act
            profiling.RegisterNode(cbn);
            var nodeData = profiling.NodeProfilingData;

            //Assert
            //Checking that the code block was registered correctly
            Assert.IsNotNull(nodeData);
            Assert.AreEqual(nodeData.Count, 1);

            //Act
            profiling.UnregisterNode(nodeData.First().Key);

            //Assert
            //Checking that the code block was unregistered successfully
            Assert.AreEqual(nodeData.Count, 0);

            var cbn2 = CreateCodeBlockNode();

            nodesList.Add(cbn2);

            //Act
            profiling.UnregisterDeletedNodes(nodesList);
            nodeData = profiling.NodeProfilingData;

            //Assert
            //Checking that the second code block was unregistered correctly
            Assert.AreEqual(nodeData.Count, 0);
        }
Пример #2
0
        public void NodeProfilingDataDispose()
        {
            //Arrange
            var profiling = new ProfilingData();
            var cbn       = CreateCodeBlockNode();

            profiling.RegisterNode(cbn);
            var nodeData = profiling.NodeProfilingData;

            //Act
            var timeSpan = nodeData.First().Value.ExecutionTime;

            nodeData.First().Value.Dispose();

            //Assert
            Assert.IsNull(timeSpan);
            Assert.IsNotNull(nodeData);
            Assert.AreEqual(nodeData.Count, 1);
        }