public void CallActOnActionWithNoReturnValueReturnsProperObject() { var act = new MockActOnFileInfo(); var info = new FileInfoItem(new FileInfo("does.not.exist")); var result = act.ActOn((IItem)info); Assert.Equal(NoReturnValue.Object, result); }
public void CanCallAct() { var act = new MockActOnFileInfo(); var info = new FileInfoItem(new FileInfo("does.not.exist")); act.ActOn((IItem)info); Assert.True(act.Acted); Assert.Equal(act.Info, info.TypedItem); }
public void CanFindAction() { var act = new MockActOnFileInfo(); var info = new FileInfoItem(new FileInfo("does.not.exist")); var getItems = new GetActionsForItem(new[] { act }); var actionsForItem = getItems.ActionsForItem(ResultForItem(info)); Assert.NotEmpty(actionsForItem); Assert.Contains(act, actionsForItem); }
public void CanNotFindActionWhichDoesntActOnItem() { var act = new MockActOnFileInfo(); var dontAct = new MockActOnFileInfoWithFilter(false); var info = new FileInfoItem(new FileInfo("does.not.exist")); var getItems = new GetActionsForItem(new IActOnItem[] { act, dontAct }); var actionsForItem = getItems.ActionsForItem(ResultForItem(info)); Assert.NotEmpty(actionsForItem); Assert.Contains(act, actionsForItem); Assert.DoesNotContain(dontAct, actionsForItem); }
public void DefaultActionForItemAppearsFirst() { var act = new MockActOnFileInfo(); var defaultAct = new MockDefaultActOnFileInfo(); var info = new FileInfoItem(new FileInfo("does.not.exist")); var getItems = new GetActionsForItem(new IActOnItem[] { act, defaultAct }, new FakeFindDefaultActionForItemStrategy(defaultAct)); var actionsForItem = getItems.ActionsForItem(ResultForItem(info)); Assert.NotEmpty(actionsForItem); Assert.Contains(defaultAct, actionsForItem); Assert.Equal(defaultAct, actionsForItem.First()); }
public void AttributeStrategyForDefaultActionForFileInfoShowsDoesNotFindAction() { var act = new MockActOnFileInfo(); var defaultAct = new MockDefaultActOnFileInfo(); var run = new Run(); var info = new FileInfoItem(new FileInfo("does.not.exist")); var actions = new IActOnItem[] { act, defaultAct }; var strategy = new GetDefaultActionBasedOnAttributeForType(); strategy.Actions = actions; var getItems = new GetActionsForItem(actions, strategy); var actionsForItem = getItems.ActionsForItem(ResultForItem(info)); Assert.NotEmpty(actionsForItem); Assert.DoesNotContain(run, actionsForItem); }