Ejemplo n.º 1
0
        public void NonAggregatableActionsReturnFalse()
        {
            var action1 = new ActionPropertyBag(_errorStore);
            var action2 = new ActionPropertyBag(_errorStore);

            Assert.IsFalse(ActionComparer.IsEquivalentClass(action1, action2));
        }
Ejemplo n.º 2
0
        public void DifferentPropertiesReturnFalse()
        {
            var action1 = new ActionPropertyBag(_errorStore);
            var action2 = new ActionPropertyBag(_errorStore);

            action1.IsAggregable = true;
            action2.IsAggregable = true;
            action1.Add(ActionPropertyNames.TenantIdConstStrKey, "TenantId");

            Assert.IsFalse(ActionComparer.IsEquivalentClass(action1, action2));
        }
Ejemplo n.º 3
0
        public void SamePropertiesAndValuesReturnEquivalent()
        {
            var action1 = new ActionPropertyBag(_errorStore);
            var action2 = new ActionPropertyBag(_errorStore);

            action1.IsAggregable = true;
            action2.IsAggregable = true;
            action1.Add(ActionPropertyNames.TenantIdConstStrKey, "TenantId1");
            action2.Add(ActionPropertyNames.TenantIdConstStrKey, "TenantId1");

            Assert.IsTrue(ActionComparer.IsEquivalentClass(action1, action2));
        }
Ejemplo n.º 4
0
        private void SetMembers(IMenuFacade menu, HttpRequest req)
        {
            ActionContextFacade SetMenuId(ActionContextFacade action)
            {
                action.MenuId = menu.Id;
                return(action);
            }

            var actionFacades = menu.MenuItems.SelectMany(i => GetMenuItem(i)).Where(af => IsVisibleAndUsable(af.action)).ToArray();

            var actions = actionFacades.Select(a => InlineActionRepresentation.Create(OidStrategy, req, SetMenuId(a.action), Flags)).ToArray();

            var actionComparer = new ActionComparer();

            actions = actions.Distinct(actionComparer).ToArray();

            Members = RestUtils.CreateMap(actions.ToDictionary(m => m.Id, m => (object)m));
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates a new ActionManager instance.
 /// </summary>
 public ActionManager()
 {
     _comparer = new ActionComparer();
     _actions = new List<Action>();
     _active = new List<Action>();
 }