コード例 #1
0
        public void Can_Resolve_Virtual_Path_With_Default_Action()
        {
            // Arrange
            IPage model = new Page {Metadata = {Url = "page1/page2"}};
            var routeValueDictionary = new RouteValueDictionary();

            // Act

            var virtualPathResolver = new VirtualPathResolver();
            var virtualPath = virtualPathResolver.ResolveVirtualPath(model, routeValueDictionary);

            // Assert

            Assert.AreEqual("page1/page2/", virtualPath);
        }
コード例 #2
0
        public void Can_Query_Page_Using_AllPages_Index_Based_On_Display_In_Menu()
        {
            // Arrange
            IPage data;

            // Act
            using (var session = _store.OpenSession()) {

                var pageModel = new Page {
                    Id = "DummyPages/1",
                    Parent = null,
                    Metadata =
                        {
                            Name = "Foo",
                            DisplayInMenu = true
                        }
                };
                session.Store(pageModel);
                session.SaveChanges();

            }
            using (var session = _store.OpenSession()) {

                data = session.Query<IPage, AllPages>()
                    .Customize(x => x.WaitForNonStaleResults())
                    .SingleOrDefault(x => x.Metadata.DisplayInMenu);
            }

            // Assert
            Assert.NotNull(data);
        }