public void ProcessButtonText_WhenThereIsAnInboxAction_ContainsNumber() { var test = new WorkspacePresenter(AnInboxActionsFilter.Providing(AnAction.In(State.Inbox)).Build(), null, null); Assert.Equal("Process (1)", test.ProcessButtonText); }
public void IsProcessingEnabled_WhenThereIsAnInboxAction_IsTrue() { var test = new WorkspacePresenter(AnInboxActionsFilter.Providing(AnAction.In(State.Inbox)).Build(), null, null); Assert.True(test.IsProcessingEnabled); }
public void Presenters_WhenThereIsAnInboxAction_ContainsInboxActionPresenter() { IAction inboxAction = AnAction.In(State.Inbox).Build(); var stubActionPresenter = new Mock <IActionPresenter>(); var test = new SingleInboxActionSelector(AnInboxActionsFilter.Providing(inboxAction).Build(), action => stubActionPresenter.Object, new AlwaysSelectedPolicy()); test.Initialize(); Assert.Contains(stubActionPresenter.Object, test.Screens); }
public void Actions_WhenWorkspaceHasMixedActions_ContainsOnlyInboxActions() { IAction inboxAction = AnAction.In(State.Inbox).Build(); WorkspaceBuilder stubWorkspace = AWorkspace .With(AnAction.In(State.Committed)) .With(inboxAction) .With(AnAction.In(State.Hold)) .With(AnAction.In(State.SomedayMaybe)); var test = new InboxActionsFilter(stubWorkspace.Build()); Assert.Contains(inboxAction, test.Actions); Assert.Equal(1, test.Actions.Count); }
public void IsProcessingEnabled_WhenAnInboxActionIsAdded_RaisesPropertyChanged() { var actions = new ObservableCollection <IAction>(); Mock <IInboxActionsFilter> inboxActionsFilter = AnInboxActionsFilter.ProvidingViewOf(actions); var test = new WorkspacePresenter(inboxActionsFilter.Object, null, null); bool eventRaised = false; test.PropertyChanged += (sender, args) => eventRaised |= args.PropertyName == "IsProcessingEnabled"; actions.Add(AnAction.In(State.Inbox).Build()); GC.KeepAlive(test); Assert.True(eventRaised); }
public void Actions_WhenAnActionIsMovedOutOfTheInbox_RaisesCollectionChanged() { Mock <IAction> stubAction = AnAction.In(State.Inbox).Mock(); IWorkspace workspace = AWorkspace.With(stubAction.Object).Build(); var test = new InboxActionsFilter(workspace); bool eventRaised = false; test.Actions.CollectionChanged += (o, args) => eventRaised = true; stubAction.Setup(x => x.ActionState).Returns(State.Committed); stubAction.Raise(x => x.PropertyChanged += null, new PropertyChangedEventArgs("ActionState")); Assert.DoesNotContain(stubAction.Object, test.Actions); Assert.Empty(test.Actions); Assert.True(eventRaised); }
public void Actions_WhenFirstInboxActionIsAddedToWorkspace_RaisesCollectionChanged() { IWorkspace workspace = AWorkspace.Build(); IAction inboxAction = AnAction.In(State.Inbox).Build(); var test = new InboxActionsFilter(workspace); bool eventRaised = false; test.Actions.CollectionChanged += (o, args) => { Assert.Same(inboxAction, args.NewItems.Cast <IAction>().Single()); eventRaised = true; }; workspace.Actions.Add(inboxAction); Assert.Contains(inboxAction, test.Actions); Assert.Equal(1, test.Actions.Count); Assert.True(eventRaised); }