Пример #1
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());
 }
Пример #2
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());
 }
Пример #3
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());
 }
Пример #4
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());
 }
Пример #5
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);
        }
Пример #6
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);
        }
Пример #7
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());
        }
Пример #8
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);
        }
Пример #9
0
        public void Test_Divide_Zero()
        {
            double rhs = 0;
            double lhs = 10;

            Logic.Calculator Calc = new Logic.Calculator();
            Calc.Number_entered(lhs);
            Calc.Division_entered();
            string result = Calc.Number_entered(rhs);

            Assert.AreEqual("Invalid Input", result);
            Assert.AreEqual("Divide by Zero Error", result.ToString());
        }
Пример #10
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());
 }
Пример #11
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());
 }
Пример #12
0
        public void Test_SquareRoot_Negative()
        {
            double lhs = -4;

            Logic.Calculator Calc = new Logic.Calculator();
            Calc.Number_entered(lhs);
            string result = Calc.Square_root_entered();

            Assert.AreEqual("Invalid Input", result);
        }
Пример #13
0
        public void Test_Reciprocal_Zero()
        {
            double lhs = 0;

            Logic.Calculator Calc = new Logic.Calculator();
            Calc.Number_entered(lhs);
            string result = Calc.Square_root_entered();

            Assert.AreEqual("Divide by Zero Error", result.ToString());
        }
Пример #14
0
        public void Test_Reciprocal_1()
        {
            Logic.Calculator Calc = new Logic.Calculator();
            Calc.Number_entered(2);
            Calc.Reciprocal_entered();
            Calc.Reciprocal_entered();
            Calc.Reciprocal_entered();
            string result = Calc.Reciprocal_entered();

            Assert.AreEqual("2", result);
        }