Пример #1
0
        public void Attached_path_values_doesnt_mutate_original()
        {
            var path = new PathData {
                Action = "hej", CurrentItem = item, Ignore = true, IsCacheable = true, IsPubliclyAvailable = true, IsRewritable = true, Path = "/x", StopItem = page, TemplateUrl = "/hello.aspx"
            };

            var detached   = path.Detach();
            var reattached = detached.Attach(persister);

            detached.Action              = "hejdå";
            detached.CurrentItem         = page;
            detached.Ignore              = false;
            detached.IsCacheable         = false;
            detached.IsPubliclyAvailable = false;
            detached.IsRewritable        = false;
            detached.Path        = "/y";
            detached.StopItem    = item;
            detached.TemplateUrl = "/world.aspx";
            detached.QueryParameters["Hello"] = "world";

            reattached.Action.ShouldNotBe("hejdå");
            reattached.CurrentItem.ShouldNotBe(page);
            reattached.Ignore.ShouldNotBe(false);
            reattached.IsCacheable.ShouldNotBe(false);
            reattached.IsPubliclyAvailable.ShouldNotBe(false);
            reattached.IsRewritable.ShouldNotBe(false);
            reattached.Path.ShouldNotBe("/y");
            reattached.StopItem.ShouldNotBe(item);
            reattached.TemplateUrl.ShouldNotBe("/world.aspx");
            reattached.QueryParameters.ContainsKey("Hello").ShouldBe(false);
        }
Пример #2
0
        public void Detach_creates_cloned_object()
        {
            var path     = new PathData();
            var detached = path.Detach();

            detached.ShouldNotBeSameAs(path);
        }
Пример #3
0
        public void Detach_removes_reference_to_item_but_leaves_id()
        {
            var path = new PathData {
                CurrentItem = page
            };

            path = path.Detach();

            path.CurrentItem.ShouldBe(null);
            path.ID.ShouldBe(1);
        }
Пример #4
0
        public void Attach_creates_cloned_object()
        {
            var path = new PathData {
                Action = "hej", CurrentItem = item, Ignore = true, IsCacheable = true, IsPubliclyAvailable = true, IsRewritable = true, Path = "/x", StopItem = page, TemplateUrl = "/hello.aspx"
            };

            var detached   = path.Detach();
            var reattached = detached.Attach(persister);

            reattached.ShouldNotBeSameAs(detached);
        }
Пример #5
0
        public void Detach_removes_reference_to_page_but_leaves_id()
        {
            var path = new PathData {
                CurrentPage = page
            };

            path = path.Detach();

            path.CurrentPage.ShouldBe(null);
            path.PageID.ShouldBe(1);
        }
Пример #6
0
        public void Attach_uses_persister_to_load_stop()
        {
            var path = new PathData {
                StopItem = page
            };

            path = path.Detach();
            path.StopItem.ShouldBe(null);

            var loadedPath = path.Attach(persister);

            loadedPath.StopItem.ID.ShouldBe(1);
        }
Пример #7
0
        public void Attach_uses_persister_to_load_page()
        {
            var path = new PathData {
                CurrentPage = page
            };

            path = path.Detach();
            path.CurrentPage.ShouldBe(null);

            var loadedPath = path.Attach(persister);

            loadedPath.CurrentPage.ID.ShouldBe(1);
        }