Inheritance: BaseMedia
        public void BeyondCompareReportTest()
        {
            if (File.Exists("beyondExpected.txt"))
                File.Delete("beyondExpected.txt");

            if (File.Exists("beyondActual.txt"))
                File.Delete("beyondActual.txt");

            Movie beyondExpected = new Movie();
            beyondExpected.Name = "Oblivion";
            beyondExpected.PaymentForTomCruise = 2000000M;

            Movie beyondActual = new Movie();
            beyondActual.Name = "Edge of Tomorrow";
            beyondActual.PaymentForTomCruise = 3000000M;

            CompareLogic compareLogic = new CompareLogic();
            compareLogic.Config.MaxDifferences = Int32.MaxValue;
            ComparisonResult result = compareLogic.Compare(beyondExpected, beyondActual);

            BeyondCompareReport beyondCompare = new BeyondCompareReport();
            beyondCompare.OutputFiles(result.Differences, "beyondExpected.txt", "beyondActual.txt");

            Assert.IsTrue(File.Exists("beyondExpected.txt"));
            Assert.IsTrue(File.Exists("beyondActual.txt"));

            if (!string.IsNullOrEmpty(beyondCompare.FindBeyondCompare()))
                beyondCompare.LaunchApplication("beyondExpected.txt", "beyondActual.txt");
        }
        public void WinMergeReportTest()
        {
            if (File.Exists("winMergeExpected.txt"))
                File.Delete("winMergeExpected.txt");

            if (File.Exists("winMergeActual.txt"))
                File.Delete("winMergeActual.txt");

            Movie winMergeExpected = new Movie();
            winMergeExpected.Name = "Oblivion";
            winMergeExpected.PaymentForTomCruise = 2000000M;

            Movie winMergeActual = new Movie();
            winMergeActual.Name = "Edge of Tomorrow";
            winMergeActual.PaymentForTomCruise = 3000000M;

            CompareLogic compareLogic = new CompareLogic();
            compareLogic.Config.MaxDifferences = Int32.MaxValue;
            ComparisonResult result = compareLogic.Compare(winMergeExpected, winMergeActual);

            WinMergeReport winMergeReport = new WinMergeReport();
            winMergeReport.OutputFiles(result.Differences, "winMergeExpected.txt", "winMergeActual.txt");

            Assert.IsTrue(File.Exists("winMergeExpected.txt"));
            Assert.IsTrue(File.Exists("winMergeActual.txt"));

            if (!string.IsNullOrEmpty(winMergeReport.FindWinMerge()))
                winMergeReport.LaunchApplication("winMergeExpected.txt", "winMergeActual.txt");
        }
        public void CsvReportTest()
        {
            if (File.Exists("movie.csv"))
                File.Delete("movie.csv");

            Movie movie1 = new Movie();
            movie1.Name = "Oblivion";
            movie1.PaymentForTomCruise = 2000000M;

            Movie movie2 = new Movie();
            movie2.Name = "Edge of Tomorrow";
            movie2.PaymentForTomCruise = 3000000M;

            CompareLogic compareLogic = new CompareLogic();
            compareLogic.Config.MaxDifferences = Int32.MaxValue;
            ComparisonResult result = compareLogic.Compare(movie1, movie2);

            CsvReport csvReport = new CsvReport();
            csvReport.OutputFile(result.Differences, "movie.csv");

            Assert.IsTrue(File.Exists("movie.csv"));

            csvReport.LaunchApplication("movie.csv");
        }
Esempio n. 4
0
        public void PrivateFieldInBaseClassNegative()
        {
            Movie movie1 = new Movie();
            movie1.Name = "Jaws";
            movie1.SetPrivateString("Boca Grande");

            Movie movie2 = new Movie();
            movie2.Name = "Jaws";
            movie2.SetPrivateString("Boca Pequeno");

            _compare.Config.ComparePrivateFields = true;
            Assert.IsFalse(_compare.Compare(movie1, movie2).AreEqual);
            _compare.Config.ComparePrivateFields = false;
        }
        public void IgnorePropertyAttributeDifferent()
        {
            Movie movie1 = new Movie();
            movie1.Name = "Mission Impossible 13, Ethan Gets Unlucky";
            movie1.PaymentForTomCruise = 20000000;

            Movie movie2 = new Movie();
            movie2.Name = "Mission Impossible 14, Ethan Gets Unlucky";
            movie2.PaymentForTomCruise = 20000001;

            //The difference for PaymentForTomCruise will be ignored becuase it is marked with the ExcludeFromEquality
            _compare.Config.AttributesToIgnore.Add(typeof(ExcludeFromEquality));
            Assert.IsFalse(_compare.Compare(movie1, movie2).AreEqual);

            _compare.Config.AttributesToIgnore.Clear();
        }