示例#1
0
        public void CalculateTest()
        {
            Div calculator = new Div();

            Assert.AreEqual(2.5, calculator.Calculate(5, 2));
            Assert.AreEqual(2, calculator.Calculate(10, 5));
            Assert.AreEqual(1, calculator.Calculate(4, 4));
        }
        public void CalculateTest(double firstValue, double secondValue, double expected)
        {
            var calculator   = new Div();
            var actualResult = calculator.Calculate(firstValue, secondValue);

            Assert.AreEqual(expected, actualResult);
        }
示例#3
0
        public void CalculateAdditionTestStrong(double firstValue, double secondValue, double expected)
        {
            ITwoArgumentsCalculator calculator = new Div();
            double result = calculator.Calculate(25, 2);

            Assert.AreEqual(12, result);
        }
示例#4
0
文件: DelTest.cs 项目: Dail99/Adil
        public void CalculateDelTestStrong(double firstValue, double secondValue, double expected)
        {
            ITwoArgumentCalculator calculator = new Div();
            double result = calculator.Calculate(firstValue, secondValue);

            Assert.AreEqual(expected, result);
        }
示例#5
0
        public void CalculateTest(double firstArgument, double secondArgument, double result, double accracy)
        {
            var testingFunction = new Div();
            var testResult      = testingFunction.Calculate(firstArgument, secondArgument);

            Assert.AreEqual(result, testResult, accracy);
        }
示例#6
0
        //client
        static void Main(string[] args)
        {
            // build the following expression ((((2+5)-1)*4)/3)
            Number a        = new Number(2);
            Number b        = new Number(5);
            Add    addition = new Add(a, b);

            Number c           = new Number(1);
            Sub    subtraction = new Sub(addition, c);

            Number d = new Number(4);
            Multi  multiplication = new Multi(subtraction, d);

            Number e      = new Number(3);
            Div    divide = new Div(multiplication, e);

            Console.WriteLine("\nResult of: {0} is: {1}\n", divide.Show(), divide.Calculate());
            Console.WriteLine("Result of: {0} is: {1}", multiplication.Show(), multiplication.Calculate());

            Console.ReadKey();
        }
示例#7
0
        public void CalculateTest()
        {
            Div calculator = new Div();

            Assert.Throws <System.DivideByZeroException>(() => calculator.Calculate(1, 0));
        }
示例#8
0
 public void DivisionTestByZero()
 {
     var calculator = new Div();
     var result     = calculator.Calculate(5, 0);
 }