Ejemplo n.º 1
0
        public void Constructor_CorrectItemsCreated()
        {
            var fakes = new NavigationItemFakes();

            fakes.RootWithNullChildren.Name.ShouldBe("0-children-null");
            fakes.Root.Name.ShouldBe("0");

            fakes.FirstChildOfRoot.Name.ShouldBe("1-1");
            fakes.SecondChildOfRoot.Name.ShouldBe("1-2");
            fakes.ThirdChildOfRoot.Name.ShouldBe("1-3");
            fakes.ThirdChildOfRoot.Visible.ShouldBeFalse();

            fakes.FirstChildOfFirstChildOfRoot.Name.ShouldBe("1-1-1");
            fakes.SecondChildOfFirstChildOfRoot.Name.ShouldBe("1-1-2");

            fakes.FirstChildOfSecondChildOfRoot.Name.ShouldBe("1-2-1");
            fakes.SecondChildOfSecondChildOfRoot.Name.ShouldBe("1-2-2");

            fakes.FirstChildOfThirdChildOfRoot.Name.ShouldBe("1-3-1");
            fakes.SecondChildOfThirdChildOfRoot.Name.ShouldBe("1-3-2");
            fakes.SecondChildOfThirdChildOfRoot.Visible.ShouldBeFalse();

            fakes.FirstChildOfFirstChildOfFirstChildOfRoot.Name.ShouldBe("1-1-1-1");
            fakes.SecondChildOfFirstChildOfFirstChildOfRoot.Name.ShouldBe("1-1-1-2");

            fakes.FirstChildOfSecondChildOfFirstChildOfRoot.Name.ShouldBe("1-1-2-1");
            fakes.SecondChildOfSecondChildOfFirstChildOfRoot.Name.ShouldBe("1-1-2-2");

            fakes.FirstChildOfFirstChildOfSecondChildOfRoot.Name.ShouldBe("1-2-1-1");
            fakes.SecondChildOfFirstChildOfSecondChildOfRoot.Name.ShouldBe("1-2-1-2");

            fakes.FirstChildOfSecondChildOfSecondChildOfRoot.Name.ShouldBe("1-2-2-1");
            fakes.SecondChildOfSecondChildOfSecondChildOfRoot.Name.ShouldBe("1-2-2-2");
        }
Ejemplo n.º 2
0
        public void GetChildren_SecondChildOfRoot_ReturnsChildrenOfSecondChildOfRoot()
        {
            var fakes          = new NavigationItemFakes();
            var navigationFake = new NavigationFake(fakes);

            var children = navigationFake.PublicGetChildren(fakes.SecondChildOfRoot);

            children.ShouldBe(navigationFake.ChildrenOfSecondChildOfRoot);
        }
Ejemplo n.º 3
0
        public void GetChildren_RootItemWithNullChildren_ReturnsNull()
        {
            var fakes          = new NavigationItemFakes();
            var navigationFake = new NavigationFake(fakes);

            var children = navigationFake.PublicGetChildren(fakes.RootWithNullChildren);

            children.ShouldBeNull();
        }
Ejemplo n.º 4
0
        public void Constructor_NavigationFakesAsConstructorArgument_CorrectChildProperties()
        {
            var fakes          = new NavigationItemFakes();
            var navigationFake = new NavigationFake(fakes);

            navigationFake.ChildrenOfRoot.Count.ShouldBe(3);
            navigationFake.ChildrenOfRoot.ElementAt(0).ShouldBeSameAs(fakes.FirstChildOfRoot);
            navigationFake.ChildrenOfRoot.ElementAt(1).ShouldBeSameAs(fakes.SecondChildOfRoot);
            navigationFake.ChildrenOfRoot.ElementAt(2).ShouldBeSameAs(fakes.ThirdChildOfRoot);

            navigationFake.ChildrenOfFirstChildOfRoot.Count.ShouldBe(2);
            navigationFake.ChildrenOfFirstChildOfRoot.ElementAt(0).ShouldBeSameAs(fakes.FirstChildOfFirstChildOfRoot);
            navigationFake.ChildrenOfFirstChildOfRoot.ElementAt(1).ShouldBeSameAs(fakes.SecondChildOfFirstChildOfRoot);

            navigationFake.ChildrenOfSecondChildOfRoot.Count.ShouldBe(2);
            navigationFake.ChildrenOfSecondChildOfRoot.ElementAt(0).ShouldBeSameAs(fakes.FirstChildOfSecondChildOfRoot);
            navigationFake.ChildrenOfSecondChildOfRoot.ElementAt(1).ShouldBeSameAs(fakes.SecondChildOfSecondChildOfRoot);

            navigationFake.ChildrenOfThirdChildOfRoot.Count.ShouldBe(2);
            navigationFake.ChildrenOfThirdChildOfRoot.ElementAt(0).ShouldBeSameAs(fakes.FirstChildOfThirdChildOfRoot);
            navigationFake.ChildrenOfThirdChildOfRoot.ElementAt(1).ShouldBeSameAs(fakes.SecondChildOfThirdChildOfRoot);

            navigationFake.ChildrenOfFirstChildOfFirstChildOfRoot.Count.ShouldBe(2);
            navigationFake.ChildrenOfFirstChildOfFirstChildOfRoot.ElementAt(0)
            .ShouldBeSameAs(fakes.FirstChildOfFirstChildOfFirstChildOfRoot);
            navigationFake.ChildrenOfFirstChildOfFirstChildOfRoot.ElementAt(1)
            .ShouldBeSameAs(fakes.SecondChildOfFirstChildOfFirstChildOfRoot);

            navigationFake.ChildrenOfSecondChildOfFirstChildOfRoot.Count.ShouldBe(2);
            navigationFake.ChildrenOfSecondChildOfFirstChildOfRoot.ElementAt(0)
            .ShouldBeSameAs(fakes.FirstChildOfSecondChildOfFirstChildOfRoot);
            navigationFake.ChildrenOfSecondChildOfFirstChildOfRoot.ElementAt(1)
            .ShouldBeSameAs(fakes.SecondChildOfSecondChildOfFirstChildOfRoot);

            navigationFake.ChildrenOfFirstChildOfSecondChildOfRoot.Count.ShouldBe(2);
            navigationFake.ChildrenOfFirstChildOfSecondChildOfRoot.ElementAt(0)
            .ShouldBeSameAs(fakes.FirstChildOfFirstChildOfSecondChildOfRoot);
            navigationFake.ChildrenOfFirstChildOfSecondChildOfRoot.ElementAt(1)
            .ShouldBeSameAs(fakes.SecondChildOfFirstChildOfSecondChildOfRoot);

            navigationFake.ChildrenOfSecondChildOfSecondChildOfRoot.Count.ShouldBe(2);
            navigationFake.ChildrenOfSecondChildOfSecondChildOfRoot.ElementAt(0)
            .ShouldBeSameAs(fakes.FirstChildOfSecondChildOfSecondChildOfRoot);
            navigationFake.ChildrenOfSecondChildOfSecondChildOfRoot.ElementAt(1)
            .ShouldBeSameAs(fakes.SecondChildOfSecondChildOfSecondChildOfRoot);
        }
Ejemplo n.º 5
0
 private NavigationFake MakeDefaultNavigationFake(NavigationItemFakes navigationItemFakes)
 {
     return(new NavigationFake(navigationItemFakes));
 }
Ejemplo n.º 6
0
 public NavigationFake(NavigationItemFakes fakes)
 {
     this.fakes = fakes;
 }