Beispiel #1
0
        public void Test_Addition_2()
        {
            Logic.Calculator Calc = new Logic.Calculator();
            Calc.Number_entered(1);
            Calc.Addition_entered();
            Calc.Number_entered(1);
            Calc.Equals();
            string result = Calc.Equals();

            Assert.AreEqual("3", result);
        }
Beispiel #2
0
        public void Test_Example()
        {
            Logic.Calculator calculator = new Logic.Calculator();
            string           result     = calculator.Number_entered(51.6);

            result = calculator.Addition_entered();
            Assert.AreEqual("51.6", result);
            result = calculator.Number_entered(25.1);
            Assert.AreEqual("25.1", result);
            Assert.AreEqual("76.7", calculator.Equals());
            Assert.AreEqual("76.7", calculator.Equals());
        }
Beispiel #3
0
        public void Multiple_Operators()
        {
            Logic.Calculator Calc = new Logic.Calculator();
            Calc.Number_entered(1);
            Calc.Addition_entered();
            Calc.Subtraction_entered();
            Calc.Number_entered(1);
            Calc.Equals();
            string result = Calc.Equals();

            Assert.AreEqual("-1", result);
        }
Beispiel #4
0
 public void Test_Addition_Calc()
 {
     Logic.Calculator calculator = new Logic.Calculator();
     calculator.Number_entered(99.5);
     calculator.Addition_entered();
     Assert.AreEqual("99.5", calculator.Equals());
 }
Beispiel #5
0
 public void Test_Reciprocal_Calc()
 {
     Logic.Calculator calculator = new Logic.Calculator();
     calculator.Number_entered(-4.0);
     calculator.Reciprocal_entered();
     Assert.AreEqual("-0.25", calculator.Equals());
 }
Beispiel #6
0
 public void Test_Multiplication_Calc()
 {
     Logic.Calculator calculator = new Logic.Calculator();
     calculator.Number_entered(30.0);
     calculator.Multiplication_entered();
     calculator.Number_entered(2.0);
     Assert.AreEqual("60", calculator.Equals());
 }
Beispiel #7
0
 public void Test_Subtraction_Calc()
 {
     Logic.Calculator calculator = new Logic.Calculator();
     calculator.Number_entered(99.5);
     calculator.Subtraction_entered();
     calculator.Number_entered(1.0);
     Assert.AreEqual("98.5", calculator.Equals());
 }
Beispiel #8
0
 public void Test_Square_Root_Calc()
 {
     Logic.Calculator calculator = new Logic.Calculator();
     calculator.Number_entered(9.0);
     calculator.Square_root_entered();
     calculator.Number_entered(2.0);
     Assert.AreEqual("3", calculator.Equals());
 }
Beispiel #9
0
 public void Test_Division_Calc()
 {
     Logic.Calculator calculator = new Logic.Calculator();
     calculator.Number_entered(30.0);
     calculator.Division_entered();
     calculator.Number_entered(2.0);
     Assert.AreEqual("15", calculator.Equals());
 }
Beispiel #10
0
        public void Test_Subtraction_1()
        {
            Logic.Calculator Calc = new Logic.Calculator();
            Calc.Number_entered(1);
            Calc.Subtraction_entered();
            Calc.Number_entered(1);
            string result = Calc.Equals();

            Assert.AreEqual("0", result);
        }
Beispiel #11
0
 public void Test_Initialization()
 {
     Logic.Calculator calculator = new Logic.Calculator();
     Assert.AreEqual("0", calculator.Equals());
 }