Пример #1
0
        private void StartBtn_Click(object sender, EventArgs e)
        {
            try
            {
                ListsComparer lstObj = new ListsComparer(List1Input.Text, List2Input.Text);

                ResultText.Text = ListsComparer.ListToStr <int>(lstObj.InList1NotInList2(), "; ");
            }

            catch (Exception exc)
            {
                MessageBsc.ShowError(exc.Message);
            }
        }
Пример #2
0
        public void CompareSortedOneEmptyTest()
        {
            //given
            var list1 = new List <int> ();
            var list2 = new List <int> {
                2, 3, 15, 20, 25
            };
            //when
            var listsComparer = new ListsComparer <int>(list1, list2);

            listsComparer.CompareSorted();
            //then
            CollectionAssert.IsEmpty(listsComparer.OnlyInList1);
            CollectionAssert.AreEqual(new List <int> {
                2, 3, 15, 20, 25
            }, listsComparer.OnlyInList2);
        }
        public bool Run()
        {
            try
            {
                ////Circle Work
                this.Printer.Writeline("////////////Work with rectangles////////////");
                Cirlce circle1 = new Cirlce(new Point(1, 1), new Point(2, 1));
                this.Printer.Writeline($"cirlse ==> {circle1}");
                Cirlce circle2 = new Cirlce(new Point(-1, 1), new Point(-1, 2));
                this.Printer.Writeline($"Intersection of Two Circles {circle1} AND {circle2}");
                foreach (Point point in circle1.Intersection(circle2))
                {
                    this.Printer.Writeline(point.ToString());
                }

                circle1.Move(1, 3);
                this.Printer.Writeline($"cirlse after move(1,3) ==> {circle1}");
                circle1.ChangeSize(new Point(-1, 1), new Point(-1, 5));
                this.Printer.Writeline($"cirlse after changeSize(-1, 1),(-1, 5) ==> {circle1}");
                this.Printer.Writeline($"Biggest between {circle1},{circle2} ===> {circle1.Biggest(circle2)}");
                this.Printer.Writeline($"Least between {circle1},{circle2} ===> {circle1.Least(circle2)}");
                ////Circle Work
                ////Rectangle Work
                this.Printer.Writeline("////////////Work with rectangles////////////");
                Rectagle rectangle1 = new Rectagle(new Point(1, 1), new Point(2, -3));
                this.Printer.Writeline($"rectangre ==> {rectangle1}");
                Rectagle rectangle2 = new Rectagle(new Point(-1, 1), new Point(5, -3));
                this.Printer.Writeline($"Intersection of Two Rectangles {rectangle1} AND {rectangle2} ==> {rectangle1.Intersection(rectangle2)}");

                rectangle1.Move(1, 3);
                this.Printer.Writeline($"rectangle after move(1,3) ==> {rectangle1}");
                rectangle1.ChangeSize(new Point(-1, 1), new Point(2, -2));
                this.Printer.Writeline($"rectangle1 after changeSize(-1, 1),(-1, 5) ==> {rectangle1}");
                this.Printer.Writeline($"Biggest between {rectangle1},{rectangle2} ===> {rectangle1.Biggest(rectangle2)}");
                this.Printer.Writeline($"Least between {rectangle1},{rectangle2} ===> {rectangle1.Least(rectangle2)}");
                ////Rectangle Work
                this.Printer.Writeline("////////////Work with Derictories////////////");
                ShowerDirectory showerDirectory = new ShowerDirectory();
                Stopwatch       myTimer         = new Stopwatch();
                myTimer.Start();
                showerDirectory.SymmetricalDifference();
                showerDirectory.Intersection();
                showerDirectory.ExpectDirectory();
                WriterToConsole writerToConsole = new WriterToConsole(showerDirectory);
                WriterToExcel   writerToExcel   = new WriterToExcel(showerDirectory);
                //writerToConsole.SymmetricalDifference();
                //writerToConsole.Intersection();
                //writerToConsole.ExpectDirectory();
                //writerToExcel.SymmetricalDifference();
                //writerToExcel.Intersection();
                //writerToExcel.ExpectDirectory();
                myTimer.Stop();
                this.Printer.Writeline($"time taken: {+myTimer.Elapsed}");
                ListsComparer a = new ListsComparer();
                a.CompareAndPrintUniqueValues();
                //ExcelTest ecxel = new ExcelTest();
                //ecxel.Write();
                return(true);
            }

            catch (Exception e)
            {
                this.Printer.Writeline(e.Message);
                Console.ReadKey();
                return(false);
            }
        }
Пример #4
0
 public DuplicateResultComparison(DuplicateResultFull resultFull1, DuplicateResultFull resultFull2)
 {
     _listsComparer = new ListsComparer <DuplicateResult>(resultFull1, resultFull2);
     _listsComparer.CompareUnsorted();
 }