示例#1
0
 /// <summary>
 /// Method that sorts arrays
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Sortingarrays(object sender, EventArgs e)
 {
     try
     {
         int[]    mas        = Validatearrays.ValidateAndConvert(FirstArgument.Text);
         string   nameButton = ((Button)sender).Name;
         ISorters sorter     = FactorySorters.GetSorting(nameButton);
         int[]    array      = sorter.Sort(mas);
         string   result     = "";
         for (int j = 0; j < array.Length; j++)
         {
             result += Convert.ToString(array[j] + " ");
         }
         Result.Text = result;
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#2
0
        public void Calculate(int[] argument, int[] result)
        {
            var testResult = Sorter.Sort(argument);

            Assert.AreEqual(testResult, result);
        }