예제 #1
0
        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,
            });
        }
예제 #2
0
        public void CreatingDataSetsCorrectValues()
        {
            var guid = Guid.NewGuid();

            var createdData = new OutgoingItemActionData(guid);

            createdData.ActionRuntimeId.Should().Be(guid);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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,
            });
        }
예제 #7
0
        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);
        }
예제 #8
0
        public void OutgoingActionDataInheritsRightBaseClass()
        {
            var data = new OutgoingItemActionData(Guid.NewGuid());

            data.Should().BeAssignableTo <ItemActionData>();
        }