public void Test_1__2_6_9() { double a = 2, b = 6, c = 9; string actError, expError = "Нет действительных корней"; double[] expResult = new double[0]; double[] actResult = QU.Result(a, b, c, out actError); Assert.AreEqual(expError, actError, "Полученное сообщение (" + actError + ") об ошибке не совпадает с ожиданием (" + expError + ")"); Assert.AreEqual(expResult.Length, actResult.Length); for (int i = 0; i < expResult.Length; i++) { Assert.AreEqual(expResult[i], actResult[i]); } }
private void Result(object sender, EventArgs e) { string error = ""; if (!(double.TryParse(textBox1.Text, out double a) && double.TryParse(textBox2.Text, out double b) && double.TryParse(textBox3.Text, out double c))) { return; } double[] result = QU.Result( double.Parse(textBox1.Text), double.Parse(textBox2.Text), double.Parse(textBox3.Text), out error); string resultStr = string.Join("\n", result); MessageBox.Show(resultStr, error); }