Esempio n. 1
0
        public void ModulusIntegers()
        {
            ModulusOperation op = ModulusOperation.Instance;

            Assert.AreEqual(1, op.Apply(3, 2));
            Assert.AreEqual(0, op.Apply(4, 2));
        }
        public IOperation CreateOperation(OperationTypes operationType)
        {
            IOperation newOperation = null;

            switch (operationType)
            {
            case OperationTypes.Addition:
                newOperation = new AdditionOperation();
                break;

            case OperationTypes.Subtraction:
                newOperation = new SubtractionOperation();
                break;

            case OperationTypes.Multiplication:
                newOperation = new MultiplicationOperation();
                break;

            case OperationTypes.Division:
                newOperation = new DivisionOperation();
                break;

            case OperationTypes.Modulus:
                newOperation = new ModulusOperation();
                break;

            case OperationTypes.Undefined:
                newOperation = new NullOperation();
                break;
            }

            return(newOperation);
        }