private void masterView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            object item = e.Node.Tag;

            detailsView.Nodes.Clear();

            if (item is TestCaseResult)
            {
                TestCaseResult testCase = (TestCaseResult)item;
                AddAssertionsToDetail(testCase.Assertions, detailsView.Nodes);
            }
            else if (item is TestSuiteErrorResult)
            {
                TestSuiteErrorResult suiteError = (TestSuiteErrorResult)item;

                TreeNode node = new TreeNode();
                node.Text     = suiteError.Message;
                node.ImageKey = node.SelectedImageKey =
                    GetImageForStatus("Suite", suiteError.Status);
                detailsView.Nodes.Add(node);

                AddBacktraceToDetail(suiteError.Backtrace, node.Nodes);
            }
            else if (item is MemoryLeak)
            {
                MemoryLeak leak = (MemoryLeak)item;

                TreeNode node = new TreeNode();
                node.Text     = "Allocated in:";
                node.ImageKey = node.SelectedImageKey = e.Node.ImageKey;
                detailsView.Nodes.Add(node);

                AddBacktraceToDetail(leak.Backtrace, node.Nodes);
            }

            detailsView.ExpandAll();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            /*
             *  CPULock, MemoryLeak, and StorageFiller run on a separate thread,
             *  so normal processing can/will continue.
             */

            //CPU Lock Example - check your CPU usage while this is running
            //CPULock locker = new CPULock();

            //Generates a file under C:\Temp that continually grows in size.
            //StorageFiller fill = new StorageFiller();

            //Throws an exception equivalent to a segmentation fault / memory access violation
            //SegFault.GenSegFault();

            //Gets "random" int and double and then adds them together
            //var x = RandomNumber.GetInt();
            //var y = RandomNumber.GetDouble();
            //Console.WriteLine(x);
            //Console.WriteLine(y);
            //Console.WriteLine(x + y);

            //Generates "nonsense" string
            //var nonsense = Nonsense.GetNonsense(Nonsense.NonsenseLength.Short).Result;
            //Console.WriteLine(nonsense);

            //Memory leak example - check memory usage while this is running
            MemoryLeak leaker = new MemoryLeak();

            while (leaker.WorkerIsRunning)
            {
                Console.WriteLine(leaker.AllocatedMemory);
            }

            Console.ReadLine();
        }
Ejemplo n.º 3
0
 static void runEx1()
 {
     MemoryLeak m = new MemoryLeak();
 }