Beispiel #1
0
        public void SelectionSortTest1()
        {
            ISort      sort = SortOperationFactory.Create("SelectionSort");
            List <int> list = new List <int>()
            {
                9, 2, 4, 3, 1
            };
            List <int> result = sort.Sort(list);

            Assert.AreEqual(result, new List <int>()
            {
                1, 2, 3, 4, 9
            });
        }
Beispiel #2
0
        public void PozyrekTest2()
        {
            ISort      sort = SortOperationFactory.Create("Pozyrek");
            List <int> list = new List <int>()
            {
                9, 2, 4, 3, 1, 0
            };
            List <int> result = sort.Sort(list);

            Assert.AreEqual(result, new List <int>()
            {
                0, 1, 2, 3, 4, 9
            });
        }
Beispiel #3
0
 private void SortCalculate(object sender, EventArgs e)
 {
     try
     {
         ISort         sort    = SortOperationFactory.Create(((Button)sender).Text);
         List <string> perList = (firstArgument.Text).Split(' ').ToList();
         List <int>    per     = perList.Select(l => Convert.ToInt32(l)).ToList();
         sort.Sort(per);
         resultField.Text = string.Join(" ", per);
     }
     catch (Exception exception)
     {
         resultField.Text = exception.Message;
     }
 }