public void Test_Sort_MyObjectFull_2()
        {
            CompareMyObject        cm = new CompareMyObject();
            ICollection <MyObject> res, res2 = null;
            List <MyObject>        fullexpected = null;
            List <MyObject>        _MyList      = Enumerable.Range(0, 200000).Select(i => new MyObject(i.ToString(), i)).Reverse().ToList();

            GC.Collect();
            GC.WaitForPendingFinalizers();

            using (TimeTracer.TimeTrack("find 10 in a list of 200000"))
            {
                res = _MyList.SortFirst(10, cm);
            }
            using (TimeTracer.TimeTrack("find 10 parallel in a list of 2000000"))
            {
                res2 = _MyList.SortFirstParallel(10, cm);
            }
            using (TimeTracer.TimeTrack("full sort a list of 200000"))
            {
                fullexpected = _MyList.OrderBy(s => s, cm).ToList();
            }

            res.Count.Should().Be(10);
            res.Should().Equal(fullexpected.Take(10));

            res2.Count.Should().Be(10);
            res2.Should().Equal(fullexpected.Take(10));
        }
        public void Test_SortFull_MyObject()
        {
            List <MyObject>        _MyList = Enumerable.Range(0, 2000000).Select(i => new MyObject(i.ToString(), i)).ToList();
            ICollection <MyObject> res, res2 = null;

            GC.Collect();
            GC.WaitForPendingFinalizers();
            using (TimeTracer.TimeTrack("find 10 in a list of 2000000"))
            {
                res = _MyList.SortFirst(10);
            }
            using (TimeTracer.TimeTrack("find 10 parallel in a list of 2000000"))
            {
                res2 = _MyList.SortFirstParallel(10);
            }
            using (TimeTracer.TimeTrack("full sort a list of 2000000"))
            {
                _MyList.Sort();
            }

            res.Count.Should().Be(10);
            res.Should().Equal(_MyList.Take(10));

            res2.Count.Should().Be(10);
            res2.Should().Equal(_MyList.Take(10));
        }
        public void Test_Sort_Int()
        {
            ICollection <int> res = null;

            using (TimeTracer.TimeTrack("find 10 in a list of 100000"))
            {
                res = _MyList.SortFirst(10);
            }
            using (TimeTracer.TimeTrack("full sort a list of 100000"))
            {
                _MyList.Sort();
            }

            res.Count.Should().Be(10);
            res.Should().Equal(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);

            _MyList = Enumerable.Range(0, 100000).Reverse().ToList();
            res     = null;
            using (TimeTracer.TimeTrack("find 10 in a list of 100000"))
            {
                res = _MyList.SortFirst(10);
            }
            using (TimeTracer.TimeTrack("full sort a list of 100000"))
            {
                _MyList.Sort();
            }

            res.Count.Should().Be(10);
            res.Should().Equal(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
        }
        public void Test_Sort_Int_Parrellel()
        {
            ICollection <int> res = null;

            using (TimeTracer.TimeTrack("find 10 in a list of 100000"))
            {
                res = _MyList.SortFirstParallel(10);
            }

            res.Count.Should().Be(10);
            res.Should().Equal(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
        }
        public void Test_Sort_Int_Parrellel_NonParelele()
        {
            _MyList = Enumerable.Range(0, 50).ToList();

            ICollection <int> res = null;

            using (TimeTracer.TimeTrack("find 10 in a list of 50"))
            {
                res = _MyList.SortFirstParallel(10);
            }

            res.Count.Should().Be(10);
            res.Should().Equal(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
        }
        public void Test_Sort_Int_Reverse()
        {
            ICollection <int> res = null;

            using (TimeTracer.TimeTrack("find 5 in a list of 100000"))
            {
                res = _MyList.SortLast(5);
            }
            using (TimeTracer.TimeTrack("full sort a list of 100000"))
            {
                _MyList.Sort();
            }

            res.Count.Should().Be(5);
            res.Should().Equal(99999, 99998, 99997, 99996, 99995);
        }