Esempio n. 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();

            }
        }
Esempio n. 2
0
 public void TestThatValueIncrements()
 {
     Counter count =new Counter();
     count.Increment();
     count.Increment();
     int actual = count.Value;
     int expected = 2;
     Assert.AreEqual(expected, actual);
 }