public void CheckAddGroupCommandIsExecutable()
        {
            var nb = new NavigationBuilderViewModel();

            var gr = new NavigationGroupViewModel();
            var model = new NavigationGroupEdit { Name = "Name" };
            Mock.Arrange(() => gr.Model).Returns(model);
            Mock.Arrange(() => nb.IsReadOnly).Returns(false);
            
            nb.NavigationGroups.Add(gr);
            nb.NewGroupName = "Name";
            
            var canExecuteCommand = nb.AddGroupCommand.CanExecute(null);
            Assert.IsFalse(canExecuteCommand);
        }
        public void TurnOnItemVisibilityTurnsOnItsGroupVisibility()
        {
            var ng = new NavigationGroupViewModel { SelectedRoleId = 1 };
            Mock.NonPublic.Arrange(ng, "PopulateNavigationItems").DoNothing();

            var groupEdit = new NavigationGroupEdit();
            var groupConfig = new NavigationGroupSecurityConfigurationEdit { RoleId = 1, CanView = false };
            Mock.Arrange(() => groupConfig.IsChild).Returns(true);
            var groupConfigurations = new NavigationGroupSecurityConfigurationList { groupConfig };

            Mock.Arrange(() => groupConfigurations.IsChild).Returns(true);

            Mock.Arrange(() => groupEdit.SecurityConfigurations).Returns(groupConfigurations);
            ng.Initialize(groupEdit, new NavigationBuilderViewModel());

            var items = new ObservableCollection<INavigationItemViewModel>();

            var itemEdit = new NavigationItemEdit();
            var itemConfig = new NavigationItemSecurityConfigurationEdit { RoleId = 1, CanView = true };
            Mock.Arrange(() => itemConfig.IsChild).Returns(true);
            var itemConfigurations = new NavigationItemSecurityConfigurationList { itemConfig };

            Mock.Arrange(() => itemEdit.SecurityConfigurations).Returns(itemConfigurations);

            for (var i = 0; i < 3; i++)
            {
                var item = new NavigationItemViewModel { SelectedRoleId = 1 };
                item.Initialize(itemEdit, ng);
                item.IsVisible = false;
                items.Add(item);
            }

            ng.NavigationItems.AddRange(items);
            ng.IsVisible = false;

            ng.NavigationItems[0].IsVisible = true;

            Assert.IsTrue(ng.IsVisible);
        }
 /// <summary>
 /// Initializes the specified model.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <param name="parent">The parent.</param>
 public void Initialize(NavigationGroupEdit model, INavigationBuilderViewModel parent)
 {
     Model = model;
     Parent = parent;
     RaisePropertyChanged(() => IsVisible);
     RaisePropertyChanged(() => IsReadOnly);
     ((ActionCommand<object>)RemoveCommand).RaiseCanExecuteChanged();
     LoadIcon();
     PopulateNavigationItems();
 }