public void Add_NavigatesToLastTracker() { var navigator = new Navigator(GetMockedTrackerFactory(), null); Assert.IsTrue(navigator.CurrentTracker == PossibleLocations.ElementAt(0)); navigator.Add(null); Assert.IsTrue(navigator.CurrentTracker == PossibleLocations.ElementAt(1)); navigator.Add(null); Assert.IsTrue(navigator.CurrentTracker == PossibleLocations.ElementAt(2)); }
public void IsNotFirst_ReturnsTrueAfterAdd() { var navigator = new Navigator(GetMockedTrackerFactory(), null); navigator.Add(null); Assert.IsTrue(navigator.IsNotFirst()); navigator.SkipToPrevious(); Assert.IsFalse(navigator.IsNotFirst()); navigator.Add(null); Assert.IsTrue(navigator.IsNotFirst()); }
private void serverDataTreeView_AfterSelect(object sender, TreeViewEventArgs e) { if (e.Node == serverDataTreeView.Nodes[0]) { return; } if (_nodeSelectedByUser) { _nav.Add(e.Node); } if (!backButton.Enabled && _nav.CanGoBack) { backButton.Enabled = true; } var directories = new Stack <string>(); var currentNode = e.Node; while (currentNode.Parent != null && currentNode.Parent != serverDataTreeView.Nodes[0]) { directories.Push(currentNode.Parent.Text); currentNode = currentNode.Parent; } var directory = String.Format("/{0}/{1}", String.Join("/", directories), e.Node.Text); directoryTextBox.Text = directory.StartsWith("//") ? directory.Remove(0, 1) : directory; }
public void NavigateToPreviousTracker_IsEnabledWhenNotFirst() { var navigator = new Navigator(GetMockedTrackerFactory(), null); navigator.Add(null); Assert.IsTrue(navigator.NavigateToPreviousTracker.CanExecute(null)); }
public void NavigateToNextTracker_IsDiabledWhenLast() { var navigator = new Navigator(GetMockedTrackerFactory(), null); navigator.Add(null); Assert.IsFalse(navigator.NavigateToNextTracker.CanExecute(null)); }
public void SkipToPrevious_UpdatesTrackerWhenNotFirst() { var navigator = new Navigator(GetMockedTrackerFactory(), null); navigator.Add(null); navigator.SkipToPrevious(); Assert.IsTrue(navigator.CurrentTracker == PossibleLocations.ElementAt(0)); }
public void NavigateToPreviousTracker_IsDisabledWhenFirst() { var navigator = new Navigator(GetMockedTrackerFactory(), null); navigator.Add(null); navigator.SkipToPrevious(); Assert.IsFalse(navigator.NavigateToPreviousTracker.CanExecute(null)); }
public void SkipToNext_HasNoEffectWhenLast() { var navigator = new Navigator(GetMockedTrackerFactory(), null); navigator.Add(null); navigator.SkipToNext(); Assert.IsTrue(navigator.CurrentTracker == PossibleLocations.ElementAt(1)); }
public void NavigateToNextTracker_UpdatesTrackerWhenNotLast() { var navigator = new Navigator(GetMockedTrackerFactory(), null); navigator.Add(null); navigator.SkipToPrevious(); navigator.NavigateToNextTracker.Execute(null); Assert.IsTrue(navigator.CurrentTracker == PossibleLocations.ElementAt(1)); }
private async void serverDataTreeView_AfterSelect(object sender, TreeViewEventArgs e) { if (e.Node == serverDataTreeView.Nodes[0]) { directoryTextBox.Text = "/"; return; } if (_nodeSelectedByUser) { _nav.Add(e.Node); } if (!backButton.Enabled && _nav.CanGoBack) { backButton.Enabled = true; } var directories = new Stack <string>(); var currentNode = e.Node; while (currentNode.Parent != null && currentNode.Parent != serverDataTreeView.Nodes[0]) { directories.Push(currentNode.Parent.Text); currentNode = currentNode.Parent; } var directory = $"/{string.Join("/", directories)}/{e.Node.Text}"; directoryTextBox.Text = directory.StartsWith("//") ? directory.Remove(0, 1) : directory; if (!_handledNodes.Contains(e.Node)) { await LoadListAsync(directory, e.Node); _handledNodes.Add(e.Node); } serverDataTreeView.SelectedNode = e.Node; e.Node.Expand(); }