Exemple #1
0
        public void CountStrings_StringsCountFromList()
        {
            // arrange
            var testStringList = new List <string> {
                "one", "two", "three"
            };
            // act
            int counter = CountStrings.StringsCountFromList(testStringList);

            // assert
            Assert.AreEqual(counter, 3);
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            if (args[0].EndsWith(".dmp") == false)
            {
                Console.WriteLine("First argument should be the canonical path to the *.dmp file");
                Environment.Exit(1);
            }

            Console.WriteLine("Loading dump... (this can take a while)");

            var runtime = CreateRuntime(args[0], string.Empty);
            var heap    = runtime.Heap;

            Console.WriteLine("Dump loaded!");

            var dict = new Dictionary <int, IAnalyse>();

            dict[1] = new CountArrays();
            dict[2] = new CountStrings();
            dict[3] = new DumpByteArrays();
            dict[4] = new DumpCharArrays();
            dict[5] = new RootedObjects();
            dict[6] = new TypesOnTheLoh();

            PresentAnalysers(dict);

            while (true)
            {
                Console.WriteLine(Environment.NewLine);

                int id = AskForAnalyserToRun();

                if (id == -1)
                {
                    Environment.Exit(0);
                }

                if (dict.ContainsKey(id))
                {
                    var sw = Stopwatch.StartNew();
                    dict[id].Execute(heap);
                    Console.WriteLine($"Took: {sw.Elapsed}");
                }
                else
                {
                    Console.WriteLine("Invalid ID");
                }

                PresentAnalysers(dict);
            }
        }