Ejemplo n.º 1
0
        private static Differences GetDifferences(string path1, string path2)
        {
            var calculator = new DifferenceCalculator(path1, path2);
            var diffs      = calculator.GetDifferences();

            return(diffs);
        }
Ejemplo n.º 2
0
        private Differences TryGetZipChanges(string zipFilePath, string previewZipFilePath)
        {
            var calculator  = new DifferenceCalculator(zipFilePath, previewZipFilePath);
            var differences = calculator.GetDifferences();

            return(differences);
        }
Ejemplo n.º 3
0
        public void Calculate_ArgsGiven_CorrectResult()
        {
            DifferenceCalculator sut = new DifferenceCalculator();

            int actual = sut.Calculate(7, 3);

            Assert.AreEqual(4, actual);
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            OutputLogo();

            var options = new Options();

            if (!CommandLine.Parser.Default.ParseArguments(args, options))
            {
                Console.WriteLine("No checksum hash files have been specified.");
                Environment.Exit(EXITCODE_ERROR);
            }

            var file1 = new FileInfo(options.File1);
            var file2 = new FileInfo(options.File2);

            CheckFile(file1);
            CheckFile(file2);

            Console.WriteLine("File 1 = {0}", file1.Name);
            Console.WriteLine("File 2 = {0}", file2.Name);
            Console.WriteLine();

            var calc = new DifferenceCalculator(file1.FullName, file2.FullName)
            {
                IgnoreCase = options.IgnoreCase,
                Verbose    = options.Verbose
            };

            var diff = calc.GetDifferences();

            if (!string.IsNullOrWhiteSpace(options.OutputFile))
            {
                WriteOutputFile(options.OutputFile, diff);
            }

            if (diff.HasDifferences())
            {
                if (options.Verbose)
                {
                    Console.WriteLine(diff);
                    Console.WriteLine("{0} and {1} are different", options.File1, options.File2);
                }

                if (options.ExitWithErrorOnDifference)
                {
                    Environment.Exit(EXITCODE_DIFF);
                }
            }
            else
            {
                Console.WriteLine("No differences found.");
            }

            Console.Read();
        }
            public void CalculateDifferences_ZipsSameEntriesDifferentContent()
            {
                var calc = new DifferenceCalculator(ZipOneEntryA1, ZipOneEntryA1_Changed);
                var diff = calc.GetDifferences();

                Assert.IsTrue(diff.HasDifferences());
                Assert.IsTrue(diff.Added.Count == 0);
                Assert.IsTrue(diff.Removed.Count == 0);
                Assert.IsTrue(diff.Changed.ContainsKey("A"));

                this.ExerciseOutputBuilders(diff);
            }
            public void CalculateDifferences_SameZip()
            {
                var calc = new DifferenceCalculator(ZipOneEntryA1, ZipOneEntryA1);
                var diff = calc.GetDifferences();

                Assert.IsFalse(diff.HasDifferences());
                Assert.IsTrue(diff.Added.Count == 0);
                Assert.IsTrue(diff.Removed.Count == 0);
                Assert.IsTrue(diff.Changed.Count == 0);

                this.ExerciseOutputBuilders(diff);
            }
        public void CalculateDifferences_DifferentEntries()
        {
            var calc = new DifferenceCalculator(TestHashes_A1, TestHashes_B1);
            var diff = calc.GetDifferences();

            Assert.IsTrue(diff.HasDifferences());
            Assert.IsTrue(diff.Added.ContainsKey("GGGGGGGG.txt"));
            Assert.IsTrue(diff.Removed.ContainsKey("WWWWWWWW.txt"));
            Assert.IsTrue(diff.Changed.Count == 0);

            this.ExerciseOutputBuilders(diff);
        }
Ejemplo n.º 8
0
        public RightSide(InterspineDescription description)
        {
            parameters       = new Dictionary <string, IParameterCalculator <InterspineDescription> >();
            names            = new Dictionary <string, string>();
            keys             = new SortedSet <string>();
            this.description = description;

            IParameterCalculator <InterspineDescription> param = new LeftSideCalculator();

            param.Description = description;
            parameters["d_1"] = param;
            names["d_1"]      = "Высота вентрального контура";
            keys.Add("d_1");

            var param1 = new DifferenceCalculator();

            param1.LeftSide   = param;
            param.Description = description;
            parameters["s"]   = param;
            names["s"]        = "Линейное смещение тела позвонка";
            keys.Add("s");

            param             = new RightSideCalculator();
            param.Description = description;
            parameters["d_2"] = param;
            names["d_2"]      = "Высота дорсального контура";
            keys.Add("d_2");

            param                 = new DifferenceAngleCalculator();
            param.Description     = description;
            parameters["alpha_s"] = param;
            names["alpha_s"]      = "Угол смещения позвонка";
            keys.Add("alpha_s");

            param                 = new ClineAngleCalculator();
            param.Description     = description;
            parameters["alpha_d"] = param;
            names["alpha_d"]      = "Угол клиновидности диска";
            keys.Add("alpha_d");

            param                 = new SpinesAngleCalculator();
            param.Description     = description;
            parameters["alpha_m"] = param;
            names["alpha_m"]      = "Угол между телами позвонков";
            keys.Add("alpha_m");
        }
Ejemplo n.º 9
0
        private Differences TryGetZipChanges(string zipFilePath, string previewZipFilePath)
        {
            var calculator = new DifferenceCalculator(zipFilePath, previewZipFilePath);
            var differences = calculator.GetDifferences();

            return differences;
        }
Ejemplo n.º 10
0
 private static Differences GetDifferences( string path1, string path2 )
 {
     var calculator = new DifferenceCalculator( path1, path2 );
     var diffs = calculator.GetDifferences();
     return diffs;
 }