Пример #1
0
        public void AddItem__GivenSingleInvalidItem__ComparerContains_OneReading_NoSignatureGroups_OneFailedReading_AndReadingMatchedReturnsFalse()
        {
            var comparer = new DebugSignaturesComparer(this.mockedReader);

            comparer.AddItem(invalidPath);

            Assert.Multiple(() =>
            {
                Assert.That(comparer.Readings.Count, Is.EqualTo(1));
                Assert.That(comparer.ReadingsBySignature.Count, Is.Zero);
                Assert.That(comparer.FailedReadings.Count, Is.EqualTo(1));
                Assert.That(comparer.ReadingsMatched, Is.False);
            });
        }
Пример #2
0
        static void Main(string[] args)
        {
            PrintHeader();
            if (args.Count() == 0 || args.Any(a => a == "h" || a == "help" || a == "-h" || a == "--help"))
            {
                PrintHelp();
                return;
            }

            var debugSignaturesComparer = new DebugSignaturesComparer();

            debugSignaturesComparer.AddItems(args.Distinct());

            PrintReadings(debugSignaturesComparer);
        }
Пример #3
0
        public void AddItem__GivenTwoValidMatchingItems__ComparerContains_TwoReadings_OneSignatureGroup_NoFailedReadings_AndReadingMatchedReturnsTrue()
        {
            var comparer = new DebugSignaturesComparer(this.mockedReader);

            comparer.AddItem(aDllPath);
            comparer.AddItem(aPdbPath);

            Assert.Multiple(() =>
            {
                Assert.That(comparer.Readings.Count, Is.EqualTo(2));
                Assert.That(comparer.ReadingsBySignature.Count, Is.EqualTo(1));
                Assert.That(comparer.FailedReadings.Count, Is.Zero);
                Assert.That(comparer.ReadingsMatched, Is.True);
            });
        }
Пример #4
0
        static void PrintReadings(DebugSignaturesComparer comparer)
        {
            Console.ForegroundColor = ConsoleColor.Yellow;
            comparer.FailedReadings.ForEach(failedReading =>
            {
                Console.WriteLine($"Failed to read signature from file: {failedReading.File}.{Environment.NewLine}Error message: {failedReading.Error}{Environment.NewLine}");
            });
            Console.ResetColor();

            comparer.ReadingsBySignature.Keys.ToList().ForEach(signature =>
            {
                var files = comparer.ReadingsBySignature[signature];

                Console.WriteLine($"Signature: {signature}");
                Console.WriteLine("Files:");

                Console.ForegroundColor = files.Count > 1 ? ConsoleColor.Green : ConsoleColor.Gray;
                files.ForEach(file => Console.WriteLine($"  {file.File}"));
                Console.ResetColor();

                Console.WriteLine();
            });
        }
Пример #5
0
        public void AreMatching_GivenTwoMismatchingItems_ReturnsFalse()
        {
            var result = DebugSignaturesComparer.AreMatching(new[] { aDllPath, cPdbPath }, this.mockedReader);

            Assert.That(result, Is.False);
        }