Пример #1
0
        static void Main(string[] args)
        {
            string greeting = "This is my simple calculator";

            Console.WriteLine(greeting);

               Counter  counter =  new Counter();

            //create a function that increments the counter
            while(true)
            {

                Console.Write("[" + counter.Value + "]>");
                counter.Increment() ;
                string userInput = Console.ReadLine();

                try
                {
                    int answer = Evaluate.Calculate(userInput);
                    Console.WriteLine(answer);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);

                }

                Console.ReadLine();

            }
        }
Пример #2
0
 public void TestThatValueIncrements()
 {
     Counter count =new Counter();
     count.Increment();
     count.Increment();
     int actual = count.Value;
     int expected = 2;
     Assert.AreEqual(expected, actual);
 }
Пример #3
0
 public void TestThatCursorStartsAtZero()
 {
     Counter count = new Counter();
     int actual = count.Value;
     int expected = 0;
     Assert.AreEqual(actual, expected);
 }