Esempio n. 1
0
        private static void Main()
        {
            while (true)
            {
                var indexOfMenuItem = Print.Menu(0, MenuItems);
                switch (indexOfMenuItem)
                {
                case 1:
                {
                    ArrayManipulating.DoTask();
                    break;
                }

                case 2:
                {
                    QuadraticSolution.DoTask();
                    break;
                }

                case 3:
                {
                    IsBeatQueen.DoTask();
                    break;
                }

                default: return;
                }

                Console.Write("Для продолжения нажмите любую клавишу . . .");
                Console.ReadKey();
            }
        }
 public void QuadraticSolution_inputSecondNonDigit()
 {
     // Arrange
     // var input = null;
     // Act.
     QuadraticSolution.DoTaskTest("1", "a", "2");
     // Assert
     // var expected = 0;
 }
 public void QuadraticSolution_inputThirdEmpty()
 {
     // Arrange
     // var input = null;
     // Act.
     QuadraticSolution.DoTaskTest("2", "1", "");
     // Assert
     // var expected = 0;
 }
 public void QuadraticSolution_inputFirstNULL()
 {
     // Arrange
     // var input = null;
     // Act.
     QuadraticSolution.DoTaskTest(null, "1", "2");
     // Assert
     // var expected = 0;
 }
        public void QuadraticSolution_inputDoubleNegative()
        {
            // Arrange
            var inputA = "-1,3";
            var inputB = "1,5";
            var inputC = "4,09";
            // Act.
            var actual = QuadraticSolution.DoTaskTest(inputA, inputB, inputC);
            // Assert
            var expected = "x1 = 2,442; x2 = -1,288";

            Assert.AreEqual(actual, expected);
        }
        public void QuadraticSolution_inputSecondZero()
        {
            // Arrange
            var inputA = "1";
            var inputB = "0";
            var inputC = "-4";
            // Act.
            var actual = QuadraticSolution.DoTaskTest(inputA, inputB, inputC);
            // Assert
            var expected = "x1 = -2; x2 = 2";

            Assert.AreEqual(actual, expected);
        }
        public void QuadraticSolution_inputFirstAndThirdZeros()
        {
            // Arrange
            var inputA = "0";
            var inputB = "5";
            var inputC = "0";
            // Act.
            var actual = QuadraticSolution.DoTaskTest(inputA, inputB, inputC);
            // Assert
            var expected = "x = 0";

            Assert.AreEqual(actual, expected);
        }
        public void QuadraticSolution_twoRepeatableValues()
        {
            // Arrange
            var inputA = "1";
            var inputB = "-4";
            var inputC = "4";
            // Act.
            var actual = QuadraticSolution.DoTaskTest(inputA, inputB, inputC);
            // Assert
            var expected = "x1 = x2 = 2";

            Assert.AreEqual(actual, expected);
        }
        public void QuadraticSolution_resultComplex()
        {
            // Arrange
            var inputA = "24";
            var inputB = "12";
            var inputC = "12";
            // Act.
            var actual = QuadraticSolution.DoTaskTest(inputA, inputB, inputC);
            // Assert
            var expected = "No sol. (complex value can be)";

            Assert.AreEqual(actual, expected);
        }