public void ReplaceOperation_ReplacesCorrectOperation()
        {
            // Arrange
            var otherOpd1 = new Operand(0);
            var otherOp   = new AddOperator();
            var otherOpd2 = new Operand(0);
            var lOperand  = new Operand(0);
            var op        = new AddOperator();
            var rOperand  = new Operand(0);
            var elements  = new Element[]
            {
                otherOpd1, otherOp, otherOpd2,
                lOperand, op, rOperand
            };
            var sut       = new ElementList(elements);
            var operation = new Operation(lOperand, op, rOperand);

            // Act
            sut.ReplaceOperation(operation, new Operand(0));
            var result = sut.FindOperation();

            // Assert
            Assert.AreEqual(otherOpd1, result.LOperand);
            Assert.AreEqual(otherOp, result.Op);
            Assert.AreEqual(otherOpd2, result.ROperand);
        }
        public void ReplaceOperationWorks()
        {
            // Arrange
            var lOperand = new Operand(0);
            var op       = new AddOperator();
            var rOperand = new Operand(0);
            var elements = new Element[]
            {
                lOperand, op, rOperand
            };
            var sut       = new ElementList(elements);
            var operation = new Operation(lOperand, op, rOperand);

            // Act
            sut.ReplaceOperation(operation, new Operand(0));
            var result = sut.FindOperation();

            // Assert
            Assert.IsNull(result);
        }
        public void ReplaceOperationCanHandleNegativeNumbers()
        {
            // Arrange
            var op         = new SubOperator();
            var rOperand   = new Operand(1);
            var newOperand = new Operand(-1);
            var elements   = new Element[]
            {
                op, rOperand
            };
            var sut       = new ElementList(elements);
            var operation = sut.FindOperation();

            // Act
            sut.ReplaceOperation(operation, newOperand);

            // Assert
            Assert.AreEqual(-1, sut.First.Value);
            Assert.IsNull(sut.FindOperation());
        }