Пример #1
0
        public static void Main(string[] args)
        {
            var bogosort = new Bogosort();
            var rand     = new Random();
            var elements = Enumerable.Range(0, 20).OrderBy(e => rand.Next()).ToList <int> ();

            elements.ForEach(e => Console.Write(e + " "));
            elements = bogosort.Sort(elements);
            Console.WriteLine();
            elements.ForEach(e => Console.Write(e + " "));
        }
Пример #2
0
        public void CanSortList()
        {
            //arrange
            _bogosort   = new Bogosort();
            arrayToSort = new int[] { 16, 1, 7, 16, 77 };

            //act
            var result = _bogosort.SortArray(arrayToSort);

            //assert
            Assert.AreEqual(new int[] { 1, 7, 16, 16, 77 }, result);
        }