示例#1
0
        public void FlyoutCreatesCorrectNumberOfGroupsForAsSingleItem()
        {
            var shell     = new Shell();
            var shellItem = new ShellItem()
            {
                FlyoutDisplayOptions = FlyoutDisplayOptions.AsSingleItem,
            };
            var shellItem2 = new ShellItem()
            {
                FlyoutDisplayOptions = FlyoutDisplayOptions.AsSingleItem,
            };

            shellItem.Items.Add(CreateShellSection());
            shellItem.Items.Add(CreateShellSection());
            shellItem2.Items.Add(CreateShellContent());
            shellItem2.Items.Add(CreateShellSection());


            shell.Items.Add(shellItem);
            shell.Items.Add(shellItem2);
            IShellController shellController = shell;
            var groups = shellController.GenerateFlyoutGrouping();

            Assert.AreEqual(groups.Count, 1);
            Assert.AreEqual(groups[0].Count, 2);
        }
示例#2
0
        public void MenuItemGeneratesForShellContent()
        {
            var shell = new TestShell();

            var shellContent = CreateShellContent();

            shellContent.MenuItems.Add(new MenuItem());
            shell.Items.Add(shellContent);

            IShellController shellController = (IShellController)shell;
            var groups = shellController.GenerateFlyoutGrouping();

            Assert.AreEqual(groups.SelectMany(x => x.OfType <IMenuItemController>()).Count(), 1);
        }
示例#3
0
        public void FlyoutItemVisibleWorksForMenuItemsAddedAsShellContent()
        {
            var shell = new TestShell();

            var shellContent = CreateShellContent();

            shellContent.MenuItems.Add(CreateNonVisibleMenuItem());
            shell.Items.Add(shellContent);

            IShellController shellController = (IShellController)shell;
            var groups = shellController.GenerateFlyoutGrouping();

            Assert.AreEqual(groups.SelectMany(x => x.OfType <IMenuItemController>()).Count(), 0);
        }
示例#4
0
        public void MenuItemGeneratesForShellSection()
        {
            var shell = new TestShell();

            var shellSection = CreateShellSection <Tab>();

            shellSection.CurrentItem.MenuItems.Add(new MenuItem());
            shellSection.FlyoutDisplayOptions = FlyoutDisplayOptions.AsMultipleItems;
            shell.Items.Add(shellSection);

            IShellController shellController = (IShellController)shell;
            var groups = shellController.GenerateFlyoutGrouping();

            Assert.AreEqual(1, groups.SelectMany(x => x.OfType <IMenuItemController>()).Count());
        }
示例#5
0
        public void FlyoutItemNotVisibleWhenShellContentSetToNotVisible()
        {
            var shell        = new TestShell();
            var shellSection = CreateShellSection();

            shellSection.FlyoutDisplayOptions = FlyoutDisplayOptions.AsMultipleItems;
            shellSection.Items.Add(CreateShellContent());
            shellSection.Items[0].IsVisible = false;
            shell.Items.Add(shellSection);

            IShellController shellController = (IShellController)shell;
            var groups = shellController.GenerateFlyoutGrouping();

            Assert.AreEqual(1, groups.Count);
            Assert.AreEqual(1, groups[0].Count);
        }
示例#6
0
        public void FlyoutItemVisibleWorksForMenuItemsTabAsMultipleItems()
        {
            var shell = new TestShell();

            var flyoutItem = CreateShellItem <FlyoutItem>();

            flyoutItem.FlyoutDisplayOptions             = FlyoutDisplayOptions.AsMultipleItems;
            flyoutItem.CurrentItem.FlyoutDisplayOptions = FlyoutDisplayOptions.AsMultipleItems;
            flyoutItem.CurrentItem.CurrentItem.MenuItems.Add(CreateNonVisibleMenuItem());
            shell.Items.Add(flyoutItem);

            IShellController shellController = (IShellController)shell;
            var groups = shellController.GenerateFlyoutGrouping();

            Assert.AreEqual(0, groups.SelectMany(x => x.OfType <IMenuItemController>()).Count());
        }
示例#7
0
        public void FlyoutItemVisibleWorksForMenuItemsAddedAsShellItem()
        {
            var shell = new TestShell();
            var item  = new MenuShellItem(CreateNonVisibleMenuItem());

            shell.Items.Add(item);

            var itemsAreEquals = item.Equals(shell.Items[0]);

            Assert.IsTrue(itemsAreEquals);

            IShellController shellController = (IShellController)shell;
            var groups = shellController.GenerateFlyoutGrouping();

            var r = groups.SelectMany(x => x.OfType <IMenuItemController>());

            Assert.AreEqual(r.Count(), 0);
        }