/// <summary>
        /// Modify the <see cref="OperationContainer"/> if it contains copy <see cref="Operation"/>
        /// </summary>
        /// <param name="operationContainer">The <see cref="OperationContainer"/> to modify</param>
        public void ModifiedCopyOperation(OperationContainer operationContainer)
        {
            var operationsToAdd = new List <Operation>();

            var copyOperationCount = operationContainer.Operations.Count(x => x.OperationKind.IsCopyOperation());

            if (copyOperationCount > 1)
            {
                // TODO: support this if needed
                throw new NotSupportedException("Only one copy operation per transaction is supported.");
            }

            var copyOperation = operationContainer.Operations.SingleOrDefault(x => x.OperationKind.IsCopyOperation());

            if (copyOperation == null)
            {
                return;
            }

            this.ComputeOperations(copyOperation);
            operationsToAdd.AddRange(this.operations);

            foreach (var operation in operationsToAdd)
            {
                operationContainer.AddOperation(operation);
            }

            // remove the copy operations
            operationContainer.RemoveOperation(copyOperation);

            // update the update iteration operation
            var iterationOperation = operationContainer.Operations.Single(x => x.OperationKind == OperationKind.Update);
            var updatedIteration   = iterationOperation.ModifiedThing.QuerySourceThing();
            var originalIteration  = iterationOperation.OriginalThing.QuerySourceThing();

            operationContainer.RemoveOperation(iterationOperation);
            operationContainer.AddOperation(new Operation(originalIteration.ToDto(), updatedIteration.ToDto(), OperationKind.Update));
        }
        public void VerifyExecutionOfOperationAddAndRemove()
        {
            var elementDefinition = new ElementDefinition(Guid.NewGuid(), 0);

            elementDefinition.PartialRoutes.Add("iteration/b58ea73d-350d-4520-b9d9-a52c75ac2b5d");
            elementDefinition.PartialRoutes.Add("EngineeringModel/5e5dc7f8-833d-4331-b421-eb2c64fcf64b");

            var clone     = elementDefinition.DeepClone <ElementDefinition>();
            var operation = new Operation(elementDefinition, clone, OperationKind.Update);

            var operationContainer = new OperationContainer(this.iterationContext);

            operationContainer.AddOperation(operation);
            Assert.AreEqual(1, operationContainer.Operations.Count());

            operationContainer.RemoveOperation(operation);
            Assert.AreEqual(0, operationContainer.Operations.Count());
        }