private void ValidateConnectionSwitch(Action connectionSwitchAction) { OctaneConfiguration.Url = Guid.NewGuid().ToString(); CollectionAssert.AreEqual(new List <string>(), WorkspaceSessionPersistanceManager.History, "Invalid initial history"); WorkspaceSessionPersistanceManager.UpdateHistory("1"); var defect = new Defect(111) { SubType = WorkItem.SUBTYPE_DEFECT }; WorkspaceSessionPersistanceManager.SetActiveEntity(defect); connectionSwitchAction(); CollectionAssert.AreEqual(new List <string>(), WorkspaceSessionPersistanceManager.History, "Mismatched history after reset"); ValidateActiveEntity(null); WorkspaceSessionPersistanceManager.UpdateHistory("2"); WorkspaceSessionPersistanceManager.SetActiveEntity(defect); CollectionAssert.AreEqual(new List <string> { "2" }, WorkspaceSessionPersistanceManager.History, "Mismatched history"); ValidateActiveEntity(defect); }
public void WorkspaceSessionPersistanceManagerTests_SetActiveEntity_ValidEntity_Success() { ValidateActiveEntity(null); var story = new Story(123) { SubType = WorkItem.SUBTYPE_STORY }; WorkspaceSessionPersistanceManager.SetActiveEntity(story); ValidateActiveEntity(story); WorkspaceSessionPersistanceManager.ClearActiveEntity(); ValidateActiveEntity(null); }
/// <summary> /// Set the given item as the current active item /// </summary> public static void SetActiveItem(OctaneItemViewModel octaneItem) { if (octaneItem == null) { return; } if (CurrentActiveItem != null) { CurrentActiveItem.IsActiveWorkItem = false; } CurrentActiveItem = octaneItem; CurrentActiveItem.IsActiveWorkItem = true; WorkspaceSessionPersistanceManager.SetActiveEntity(CurrentActiveItem.Entity); }
public void WorkspaceSessionPersistanceManagerTests_SetActiveEntity_ChangeActiveEntity_Success() { ValidateActiveEntity(null); var story = new Story(123) { SubType = WorkItem.SUBTYPE_STORY }; WorkspaceSessionPersistanceManager.SetActiveEntity(story); ValidateActiveEntity(story); var defect = new Defect(456) { SubType = WorkItem.SUBTYPE_DEFECT }; WorkspaceSessionPersistanceManager.SetActiveEntity(defect); ValidateActiveEntity(defect); }