public IEnumerator CreateAndDestroyOperationComponent_Undo_OperationExists() { var scene = TestUtility.defaultScene; var operation = TestUtility.CreateGameObjectWithUndoableOperationComponent(); var operationGameObject = operation.gameObject; Assert.AreEqual(0, CSGManager.TreeBranchCount, "Expected 0 TreeBranches to Exist"); Assert.AreEqual(0, CSGManager.TreeNodeCount, "Expected 0 TreeNodes to Exist"); Undo.FlushUndoRecordObjects(); Undo.IncrementCurrentGroup(); yield return(null); Assert.AreEqual(1, CSGManager.TreeBranchCount, "Expected 1 TreeBranch to Exist"); Assert.AreEqual(2, CSGManager.TreeNodeCount, "Expected 2 TreeNodes to Exist"); Undo.DestroyObjectImmediate(operation); yield return(null); Assert.True(operationGameObject); Assert.False(operation); Assert.AreEqual(0, CSGManager.TreeBranchCount, "Expected 0 TreeBranches to Exist"); Assert.AreEqual(0, CSGManager.TreeNodeCount, "Expected 0 TreeNodes to Exist"); Assert.AreEqual(0, ChiselNodeHierarchyManager.RootCount(scene)); Undo.PerformUndo(); operation = operationGameObject.GetComponent <ChiselOperation>(); yield return(null); Assert.True(operationGameObject); Assert.True(operation); Assert.AreEqual(1, CSGManager.TreeBranchCount, "Expected 1 TreeBranch to Exist"); Assert.AreEqual(2, CSGManager.TreeNodeCount, "Expected 2 TreeNodes to Exist"); Assert.AreEqual(1, ChiselNodeHierarchyManager.RootCount(scene)); }