public void FilterDigit_WhenInputListOfIntWithZero_And7_ShouldReturnNumbersWith_7() { List <int> temp = new List <int>() { 3, 66, 0, 54, 23, 76, 87, 0, 75, 23, 7 }; var result = Task_4.FilterDigit(temp, 7); Assert.AreEqual(76, result[0]); Assert.AreEqual(87, result[1]); Assert.AreEqual(75, result[2]); Assert.AreEqual(7, result[3]); }
public void FilterDigit_WhenInputListOfLongAndShortAndZeroAndNegativeAndPositiveInt_And7_ShouldReturnNumbersWith_7() { List <int> temp = new List <int>() { 387, -66692, 0, 541234, 233315, -767775, 877798, 0, 745455, -2324, 7896545 }; var result = Task_4.FilterDigit(temp, 7); Assert.AreEqual(387, result[0]); Assert.AreEqual(-767775, result[1]); Assert.AreEqual(877798, result[2]); Assert.AreEqual(745455, result[3]); Assert.AreEqual(7896545, result[4]); }
public void FilterDigit_WhenInputListOfNegativeAndPositiveInt_And7_ShouldReturnNumbersWith_7() { List <int> temp = new List <int>() { 3, 66, -87, 54, 23, 76, -87, 45, 75, -23, 7 }; var result = Task_4.FilterDigit(temp, 7); Assert.AreEqual(-87, result[0]); Assert.AreEqual(76, result[1]); Assert.AreEqual(-87, result[2]); Assert.AreEqual(75, result[3]); Assert.AreEqual(7, result[4]); }
public static void TaskLauncher() { Console.WriteLine("Please enter the number of homework task you want to launch: "); string taskNumber = Console.ReadLine(); int x; if (int.TryParse(taskNumber, out x)) { if (Convert.ToInt32(taskNumber) == 1 || Convert.ToInt32(taskNumber) == 2) { FigureComparision.CreatAndCompareFigures(); } else if (Convert.ToInt32(taskNumber) == 3) { Task3Runner.RunTask3(); } else if (Convert.ToInt32(taskNumber) == 4) { //Task_4.Reverse(); Task_4.PalindromeCheck(); } else if (Convert.ToInt32(taskNumber) == 5) { TaskControl.Task5Selector(); } else if (Convert.ToInt16(taskNumber) == 7) { DictioanryHelper.FillDictionary(); DictioanryHelper.AddNewCountryToDictionary(); DictioanryHelper.AddNewCountryToFile(); DictioanryHelper.SetTelenorSupported(); DictioanryHelper.PrintAllNonSupportedCountries(); DictioanryHelper.SaveChangesToFile(); } else if (Convert.ToInt16(taskNumber) == 6) { ChapletRunner.StartChaplet(); } else if (Convert.ToInt16(taskNumber) == 8) { Task_8_Launcher.LounchTask8(); } } else { Console.WriteLine("Task you are looking for does not exist or the number is incorrect."); } }
private async void button6_Click(object sender, EventArgs e) { if (Tab4Checks()) { button6.Visible = false; var inputValues = textBox9.Text; var processedResult = ""; var splitedValues = textBox9.Text.Split(new string[] { ",", "-", ";" }, StringSplitOptions.RemoveEmptyEntries); textBox10.Text = DateTime.Now + ": Calculating in progress..\r\n"; backgroundWorker4.RunWorkerAsync(); var n = int.Parse(splitedValues.ElementAt(0)); //число var m = int.Parse(splitedValues.ElementAt(1)); //кол-во разрядов var useModVersion = checkBox3.Checked; var selectedConst = (int)numericUpDown3.Value; await Task.Run(() => { try { processedResult = Task_4.AlgorithmHEntryQueued(n, m, useModVersion, selectedConst); } catch (Exception ex) { processedResult = "Error occured: " + ex.Message; } }); textBox10.Text += DateTime.Now + ":" + processedResult; button6.Visible = true; backgroundWorker4.CancelAsync(); } }