public void TestMethod2() { task.Task task1 = new task.Task(-1, -1, 0); int positive; int negative; task1.AnswerTask(out positive, out negative); Assert.AreEqual(0, positive); Assert.AreEqual(2, negative); }
public void TestMethod1() { task.Task task1 = new task.Task(1, 1, 1); int positive; int negative; task1.AnswerTask(out positive, out negative); Assert.AreEqual(3, positive); Assert.AreEqual(0, negative); }
//Событие, где мы записываем ответ полученный в результате работы метода AnswerTask() класса Task. private void GetAnswer_Click(object sender, EventArgs e) { int positiveCount = 0; int negativeCount = 0; task.Task task1 = new task.Task((int)a.Value, (int)b.Value, (int)c.Value); //Конструктор класса Task task1.AnswerTask(out positiveCount, out negativeCount); answer1.Text = positiveCount.ToString(); answer2.Text = negativeCount.ToString(); }
private void addButton_Click(object sender, EventArgs e) { if (taskBox.Text != "") { //creates a new Task and adds it to the todo list task.Task newTask = new task.Task(taskBox.Text); taskHolder.Rows.Add(newTask.getText()); taskBox.Text = null; } }
//обработчик кнопки Open File private void openFileButton_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { solveButton.Enabled = true; using (StreamReader sr = new StreamReader(File.Open(openFileDialog1.FileName, FileMode.Open))) { if (mode) sample = new SLAE(sr, monitor, result); else sample = new Integral(sr, monitor, result); } } }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog open = new OpenFileDialog(); //prompt user to open file if (open.ShowDialog() == DialogResult.OK) { StreamReader sr = null; // read the current tasks in from file try { sr = new StreamReader(open.OpenFile()); string[] curTasks = sr.ReadLine().Split('|'); foreach (string task in curTasks) { //load tasks into current tasks list task.Task t = new task.Task(task); if (t.getText() != "") { taskHolder.Rows.Add(t.getText()); } } //create string array to hold tasks string[] completedTasks = sr.ReadLine().Split(','); if (completedTasks[0] != null) { //load tasks into completed tasks list foreach (string task in completedTasks) { task.Task t = new task.Task(task); taskCompletedHolder.Rows.Add(t.getText()); } } } catch { } finally { //close the stream reader if (sr != null) { sr.Close(); } } } }