public void MergeTest() { // ReSharper disable AccessToModifiedClosure // Normal merge. The origin workspace is removed. TestWorkspace from = _manager.CreateEmptyWorkspace(); TestWorkspace target = _manager.CreateEmptyWorkspace(); _manager.Merge(from, target); Assert.IsFalse(_manager.Workspaces.Contains(from)); Assert.IsTrue(_manager.Workspaces.Contains(target)); // Merge with itself, nothing should happen. _manager.Merge(target, target); // Attempting to merge workspaces not managed by this manager. AssertHelper.ThrowsException <ArgumentException>(() => _manager.Merge(new TestWorkspace(), target)); AssertHelper.ThrowsException <ArgumentException>(() => _manager.Merge(null, target)); AssertHelper.ThrowsException <ArgumentException>(() => _manager.Merge(target, new TestWorkspace())); AssertHelper.ThrowsException <ArgumentException>(() => _manager.Merge(target, null)); AssertHelper.ThrowsException <ArgumentException>(() => _manager.Merge(null, null)); // Can't merge startup workspace _manager = new TestWorkspaceManager(); // Previous exception disposed the manager. target = _manager.CreateEmptyWorkspace(); AssertHelper.ThrowsException <ArgumentException>(() => _manager.Merge(_manager.StartupWorkspace, target)); // Can't merge current desktop. _manager = new TestWorkspaceManager(); // Previous exception disposed the manager. TestWorkspace current = _manager.CreateEmptyWorkspace(); target = _manager.CreateEmptyWorkspace(); _manager.SwitchToWorkspace(current); AssertHelper.ThrowsException <ArgumentException>(() => _manager.Merge(current, target)); // ReSharper restore AccessToModifiedClosure }
public void TestInitialize() { _manager = new TestWorkspaceManager(); }