public void ActionItemWillOnlyReturnVisibleItems() { var action = new RealAction(); var otherAction = new RealAction(); RealActionItem.ActionGenerator = () => new List <IItemAction <OutgoingItemActionData, IncomingItemActionData> > { action, otherAction }; var data = new OutgoingItemActionData(action.RuntimeId); var otherData = new OutgoingItemActionData(otherAction.RuntimeId); action.ActionDataBuilder = x => data; otherAction.ActionDataBuilder = x => otherData; otherAction.SetVisibleCheck((x) => false); var item = (RealActionItem)this.ItemFactory.CreateItem(ActionItemHandle, 1); item.GetAllActionData(new object()).Should().Equal(new List <OutgoingItemActionData> { data, }); }
public void CreatingDataSetsCorrectValues() { var guid = Guid.NewGuid(); var createdData = new OutgoingItemActionData(guid); createdData.ActionRuntimeId.Should().Be(guid); }
public void ActionItemReturnsAllCreatedData() { var action = new RealAction(); RealActionItem.ActionGenerator = () => new List <IItemAction <OutgoingItemActionData, IncomingItemActionData> > { action, }; var data = new OutgoingItemActionData(action.RuntimeId); action.ActionDataBuilder = x => data; var item = (RealActionItem)this.ItemFactory.CreateItem(ActionItemHandle, 1); item.GetAllActionData(new object()).Should().ContainSingle(x => x == data); }
public void DisablingItemKeepsActionDataInResult() { var action = new RealAction(); RealActionItem.ActionGenerator = () => new List <IItemAction <OutgoingItemActionData, IncomingItemActionData> > { action, }; var data = new OutgoingItemActionData(action.RuntimeId); action.ActionDataBuilder = x => data; action.SetVisibleCheck(x => true); action.SetEnabledCheck(x => false); var item = (RealActionItem)this.ItemFactory.CreateItem(ActionItemHandle, 1); item.GetAllActionData(new object()).Should().ContainSingle(x => x == data); }
public void ActionItemWillOnlyReturnVisibleItemsWithPositiveCheck() { var action = new RealAction(); var otherAction = new RealAction(); RealActionItem.ActionGenerator = () => new List <IItemAction <OutgoingItemActionData, IncomingItemActionData> > { action, otherAction }; var data = new OutgoingItemActionData(action.RuntimeId); var otherData = new OutgoingItemActionData(otherAction.RuntimeId); action.ActionDataBuilder = x => data; otherAction.ActionDataBuilder = x => otherData; otherAction.SetVisibleCheck(x => true); var item = (RealActionItem)this.ItemFactory.CreateItem(ActionItemHandle, 1); item.GetAllActionData(new object()).Should().OnlyContain(x => x == data || x == otherData); }
public void ActionItemReturnsNonNullCreatedMultipleData() { var action = new RealAction(); var otherAction = new RealAction(); RealActionItem.ActionGenerator = () => new List <IItemAction <OutgoingItemActionData, IncomingItemActionData> > { action, otherAction }; var data = new OutgoingItemActionData(action.RuntimeId); action.ActionDataBuilder = x => data; otherAction.ActionDataBuilder = x => null; var item = (RealActionItem)this.ItemFactory.CreateItem(ActionItemHandle, 1); item.GetAllActionData(new object()).Should().Equal(new List <OutgoingItemActionData> { data, }); }
public void PassingNullAsVisibleCheckCountsAsVisible() { var action = new RealAction(); var otherAction = new RealAction(); RealActionItem.ActionGenerator = () => new List <IItemAction <OutgoingItemActionData, IncomingItemActionData> > { action, otherAction }; var data = new OutgoingItemActionData(action.RuntimeId); var otherData = new OutgoingItemActionData(otherAction.RuntimeId); action.ActionDataBuilder = x => data; otherAction.ActionDataBuilder = x => otherData; otherAction.SetVisibleCheck(x => false); otherAction.SetVisibleCheck(null); var item = (RealActionItem)this.ItemFactory.CreateItem(ActionItemHandle, 1); item.GetAllActionData(new object()).Should().OnlyContain(x => x == data || x == otherData); }
public void OutgoingActionDataInheritsRightBaseClass() { var data = new OutgoingItemActionData(Guid.NewGuid()); data.Should().BeAssignableTo <ItemActionData>(); }