//[Ignore] // Allows us to skip UT
        public void DivideSimple()
        {
            var    calculator = new MyCalculator.Calculator();
            double quotient   = calculator.Divide(10, 2);

            Assert.AreEqual(5, quotient);
        }
        public void Divide_ByZero()
        {
            var target = new Calculator();
            var ret = target.Divide(20, 0);

            Assert.AreEqual(0, ret);
        }
Ejemplo n.º 3
0
 public void TestMultiply()
 {
     Calculator calculator = new Calculator();
     calculator.Operand1 = 10;
     calculator.Operand2 = 20;
     Assert.AreEqual(calculator.Multiply(), 200);
 }
        public void SubtractSimple()
        {
            var calculator = new MyCalculator.Calculator();
            int sum        = calculator.Subtract(5, 15);

            Assert.AreEqual(-10, sum);
        }
Ejemplo n.º 5
0
 public void TestSubtract()
 {
     Calculator calculator = new Calculator();
     calculator.Operand1 = 10;
     calculator.Operand2 = 20;
     Assert.AreEqual(calculator.Subtract(), -10);
 }
Ejemplo n.º 6
0
 public void TestAdd()
 {
     Calculator calculator = new Calculator();
     calculator.Operand1 = 10;
     calculator.Operand2 = 20;
     Assert.AreEqual(calculator.Add(), 30);
 }
Ejemplo n.º 7
0
 public void TestDevide()
 {
     Calculator calculator = new Calculator();
     calculator.Operand1 = 10;
     calculator.Operand2 = 20;
     Assert.AreEqual(calculator.Divide(), 0);
 }
        public void Subtract_ValidNumbers()
        {
            var target = new Calculator();
            var ret = target.Subtract(2, 1);

            Assert.AreEqual(1, ret);
        }
        public void Multiply_ValidNumbers()
        {
            var target = new Calculator();
            var ret = target.Multiply(2, 4);

            Assert.AreEqual(8, ret);
        }
        public void GetHypo()
        {
            var target = new Calculator();
            var ret = target.Pythagorus(3, 4);

            Assert.AreEqual(5, ret);
        }
        public void Divide_ValidNumbers()
        {
            var target = new Calculator();
            var ret = target.Divide(20, 2);

            Assert.AreEqual(10, ret);
        }
        public void Add_ValidNumbers()
        {
            var target = new Calculator();
            var ret = target.Add(1, 2);

            Assert.AreEqual(3, ret);
        }
Ejemplo n.º 13
0
 public void AddSimple()
 {
     //ARRANGE: (set up environment to run test)
     var calculator = new MyCalculator.Calculator();
     //ACT: (run code we are trying to test)
     int sum = calculator.Add(1, 2);
     //ASSERT: (validate expected results)
     Assert.AreEqual(3, sum);
 }
        [Priority(0)]                 // Another 'Attribute' for catagorizing
        public void AddSimple()
        {
            //ARRANGE: (set up environment to run test)
            var calculator = new MyCalculator.Calculator();
            //ACT: (run code we are trying to test)
            int sum = calculator.Add(1, 2);

            //ASSERT: (validate expected results)
            Assert.AreEqual(3, sum);
        }
Ejemplo n.º 15
0
 public static void Main()
 {
     Calculator caclulator = new Calculator();
     caclulator.Operand1 = 100;
     caclulator.Operand2 = 200;
     Console.WriteLine(caclulator.Add());
     Console.WriteLine(caclulator.Subtract());
     Console.WriteLine(caclulator.Multiply());
     Console.WriteLine(caclulator.Divide());
 }
Ejemplo n.º 16
0
        public void Divide_WithTenAndZero_ShouldBeThrowArgumentException()
        {
            // Arrange
            int value1 = 10;
            int value2 = 0;
            decimal actualValue;

            // Act
            Calculator calc = new Calculator();
            actualValue = calc.Divide(value1, value2);
        }
Ejemplo n.º 17
0
        public void testAdd()
        {
            // Arrange
            Calculator calculator = new Calculator();
            int augend = 1,
                addend = 2,
                expected = 3,
                actual;

            // Act
            actual = calculator.Add(augend, addend);

            // Assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 18
0
        public void Divide_WithTenAndFive_ShouldBeReturnTwo()
        {
            // Arrange
            int value1 = 10;
            int value2 = 5;
            decimal actualValue;
            decimal expectedValue = 2M;

            // Act
            Calculator calc = new Calculator();
            actualValue = calc.Divide(value1, value2);

            // Assert
            Assert.AreEqual(expectedValue, actualValue);
        }
Ejemplo n.º 19
0
        public void TestSubstract()
        {
            // Arrange
            Calculator calculator = new Calculator();
            int minuend = 3,
                subtrahend = 2,
                expected = 1,
                actual;

            // Act
            actual = calculator.Substract(minuend, subtrahend);

            // Assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 20
0
        public void Multiply_WithTenAndFive_ShouldReturnFiveTen()
        {
            // Arrange
            int value1 = 10;
            int value2 = 5;
            int expectedValue = 15;
            int actualValue;

            // Act
            Calculator calc = new Calculator();
            actualValue = calc.Multiply(value1, value2);

            // Assert
            Assert.AreEqual(expectedValue, actualValue);
        }
Ejemplo n.º 21
0
 // Example of Front End Code
 public int Test(int dividend, int divisor)
 {
     var calculator = new Calculator();
     int result = 0;
     try
     {
         result = calculator.Divide(dividend, divisor);
     }
     catch (DivideByZeroException)
     {
         return int.MaxValue;
     }
     catch (Exception)
     {
         result = int.MinValue;
     }
     return result;
 }
        public void DivideByZero()
        {
            var calculator = new MyCalculator.Calculator();

            calculator.Divide(10, 0);
        }
Ejemplo n.º 23
0
        static void Main(string[] args)
        {
            Calculator calc = new Calculator();

            calc.Run();
        }
Ejemplo n.º 24
0
        public void TestCreateACalculator()
        {
            Calculator eenCalculator = new Calculator();
            double bigInt = 1;
            Assert.AreEqual(bigInt, eenCalculator.Add(0, 1), "0 + 1 is in decimale Stelsel  1 ");
            
            ///Invariant introduceren...
            for (int i = 0; i < 1000; i++)///int.MaxValue=> te lang?
            {
                Assert.AreEqual((double)i + 1, eenCalculator.Add(i, 1));
            }

            #region simple calculator


            bigInt = 10;
            Assert.AreEqual(bigInt, eenCalculator.TelOp(new double[] { 1, 2, 3, 4 }));
            bigInt = 10;
            Assert.AreEqual(bigInt, eenCalculator.PersistResults());

            #endregion

            var eenComputer = new Computer<TertaireStelsel>();
            IMathFunctions andereCalculator = eenComputer.MathFunctions;
            IOutput anderUItvoer = eenComputer.Output;
            
            bigInt = 2;
            Assert.AreEqual(bigInt, andereCalculator.Add(1, 1), "1+1=2 ook in tertaire Stelsel.");
            Assert.AreEqual(bigInt, anderUItvoer.PersistResults());

            
            ///eenCalculator.GaInTertaireStelselModus();///???
            /// ///eenCalculator.GaInTertaireStelselModus();///???
            /// ///eenCalculator.GaInXStelselModus();///???
            /// ///eenCalculator.GaInTertaireStelselModus(X);///???
            /// ///eenCalculator.GaInStelselModus(Y);///???
            #region uitbreiding stelsel (functionaliteit) naar ander uitvoer.

            //var andereModus = new Computer<TertaireStelsel>();
            //IMathFunctions andereCalculator = andereModus.MathFunctions;
            //IOutput anderUItvoer = andereModus.Output;

            //bigInt = 1;
            //Assert.AreEqual(bigInt, andereCalculator.Add(1, 2), "review tertaire Stelsel.");
            //Assert.AreEqual(bigInt, anderUItvoer.PersistResults());

            //MathFunctions<TCalculator> calc = new MathFunctions<TCalculator>();
            
            //Assert.AreEqual(bigInt, andereCalculator.Add(353, 445), "(1242) review quartaire Stelsel.");
            
            //Assert.AreEqual("", eenCalculator.Add(0, 1), "review kwintaire Stelsel.");
            //Assert.AreEqual("", eenCalculator.Add(0, 1), "review sextaire Stelsel."); 


            #endregion

            #region Uitbreiding onbekende functionaliteit



            Log.ConsoleWriteline(ulong.MaxValue.ToString());
            Log.ConsoleWriteline(double.MaxValue.ToString());
            Log.ConsoleWriteline(long.MaxValue.ToString());
            double getal = 18446744073709551615 - 1;
            Log.ConsoleWriteline(getal.ToString());
            #endregion
            
        }
Ejemplo n.º 25
0
 private void FixBotton_Click(object sender, EventArgs e)
 {
     this.OutPutBox.Text = Calculator.FixExpression(Convert.ToString(this.InPutBox.Text.Trim()));
 }
Ejemplo n.º 26
0
 public void SubtractSimple()
 {
     var calculator = new MyCalculator.Calculator();
     int sum = calculator.Subtract(5, 15);
     Assert.AreEqual(-10, sum);
 }
Ejemplo n.º 27
0
 public void DivideSimple()
 {
     var calculator = new MyCalculator.Calculator();
     double quotient = calculator.Divide(10, 2);
     Assert.AreEqual(5, quotient);
 }
Ejemplo n.º 28
0
 public void DivideByZero()
 {
     var calculator = new MyCalculator.Calculator();
     calculator.Divide(10, 0);
 }