예제 #1
0
        public void PromptUserTest()
        {
            /*test that the user is being prompted to enter a number
             * Simulating the console for this to assert on expected/actual prompt*/
            var          calc   = new CalculatorApp.Program();
            StringWriter output = new StringWriter();

            Console.SetOut(output);
            calc.PromptUserQuestion();
            string expected = string.Format("Type a number, and then press Enter\r\n", Environment.NewLine);

            Assert.AreEqual(expected, output.ToString());
        }
예제 #2
0
        public static void Main(string[] args)
        {
            // Display title as the C# console calculator app.

            Console.WriteLine("Console Calculator in C#\r");
            Console.WriteLine("------------------------\n");
            //Console.ReadKey();
            var program = new Program();

            // execute program functions
            program.PromptUserQuestion();
            program.UserInput1();
            program.UserInput2();
            program.UserOption();
            program.UserAnswer();
            program.PromptUserExit();
        }