Пример #1
0
        public void executeOperationTest()
        {
            TCPTransport trans = new TCPTransport(System.Net.IPAddress.Loopback, 11222);
            Codec        codec = new Codec();

            ClearOperation target    = new ClearOperation(codec, null, 0, null);
            Transport      transport = null;

            target.executeOperation(transport);
        }
Пример #2
0
        /// <summary>
        /// Clears the cache
        /// </summary>
        public void clear()
        {
            ClearOperation op = operationsFactory.newClearOperation();

            transport = transportFactory.getTransport();
            try
            {
            }
            finally
            {
                transportFactory.releaseTransport(transport);
            }
            op.executeOperation(transport);
        }
Пример #3
0
        public void Clear()
        {
            var result = new ClearOperation().Perform(10);

            Assert.AreEqual(0, result);
        }
Пример #4
0
 private void WriteClearOperation(BinaryWriter writer, ClearOperation operation)
 {
 }
Пример #5
0
 public ClearOperationTest()
 {
     _operator = new ClearOperation(Name);
 }
Пример #6
0
        /// <summary>
        /// Calls the IOperation that corresponds to the input OperationType
        /// </summary>
        /// <param name="operationType">The operation to perform.</param>
        public void PerformOperation(OperationType operationType)
        {
            IOperation operation = null;

            switch (operationType)
            {
            case OperationType.Add:
                operation = new AddOperation();
                break;

            case OperationType.Minus:
                operation = new MinusOperation();
                break;

            case OperationType.Multiply:
                operation = new MultiplyOperation();
                break;

            case OperationType.Divide:
                operation = new DivideOperation();
                break;

            case OperationType.Negate:
                operation = new NegateOperation();
                break;

            case OperationType.SquareRoot:
                operation = new SquareRootOperation();
                break;

            case OperationType.Exponential:
                operation = new ExponentialOperation();
                break;

            case OperationType.Power:
                operation = new PowerOperation();
                break;

            case OperationType.Reciprocal:
                operation = new ReciprocalOperation();
                break;

            case OperationType.Sine:
                operation = new SineOperation();
                break;

            case OperationType.Cosine:
                operation = new CosineOperation();
                break;

            case OperationType.Clear:
                operation = new ClearOperation();
                break;

            case OperationType.Swap:
                operation = new SwapOperation();
                break;

            case OperationType.Rotate:
                operation = new RotateOperation();
                break;
            }
            if (operation != null)
            {
                /*
                 * Exception handling is done within each class that implements IOperation.
                 * Refactoring to multiple operation types (e.g. BinaryOperation,
                 * UnaryOperation, and StackOperation) can make the code DRYer as each type
                 * can use similar exception handling.
                 */
                operation.Perform(stack);
            }
        }