Ejemplo n.º 1
0
        void describe_cacheing()
        {
            before = () =>
            {
                blogs = new Blogs();

                comments = new Comments();

                CreateConventionalBlogTable();

                CreateConventionalCommentTable();

                blogId = new { Title = "Some Blog", Body = "Lorem Ipsum" }.InsertInto("Blogs");

                commentId = new { BlogId = blogId, Text = "Comment 1" }.InsertInto("Comments");
            };

            act = () =>
            {
                comment = comments.Single(commentId);

                comment.Blog();
            };

            context["belongs to props are changed from external source"] = () =>
            {
                act = () => blogs.Update(new { Title = "Other Title" }, blogId as object);

                it["belongs to properties in comments remain unchanged"] = () =>
                    (comment.Blog().Title as string).should_be("Some Blog");

                it["discarded cache updates properties"] = () =>
                    (comment.Blog(discardCache: true).Title as string).should_be("Other Title");
            };
        }
Ejemplo n.º 2
0
        void before_each()
        {
            seed = new Seed();

            blogs = new Blogs();

            comments = new Comments();
        }
Ejemplo n.º 3
0
        void before_each()
        {
            blogs = new Blogs();

            blogs.Projection = d => new BlogWithAutoProps(d).InitializeExtensions();

            comments = new Comments();

            comments.Projection = d => new CommentWithAutoProps(d).InitializeExtensions();
        }
Ejemplo n.º 4
0
        void describe_retrieval_of_belongs_to()
        {
            context["given blogs that have many comments"] = () =>
            {
                before = () =>
                {
                    comments = new Comments();

                    CreateConventionalBlogTable();

                    CreateConventionalCommentTable();

                    blogId = new { Title = "Some Blog", Body = "Lorem Ipsum" }.InsertInto("Blogs");

                    commentId = new { BlogId = blogId, Text = "Comment 1" }.InsertInto("Comments");
                };

                VerifyBelongsToRetrieval();
            };
        }
Ejemplo n.º 5
0
        void before_each()
        {
            seed = new Seed();

            seed.PurgeDb();

            blogs = new Blogs();

            blogs.Projection = d => new BlogWithAutoProps(d).InitializeExtensions();

            comments = new Comments();

            (comments as Comments).Projection = d => new CommentWithAutoProps(d).InitializeExtensions();

            CreateBlogTable();

            CreateCommentTable();

            blogId = new { Title = "Some Blog", Body = "Lorem Ipsum" }.InsertInto("Blogs");

            commentId = new { BlogId = blogId, Text = "Comment 1" }.InsertInto("Comments");
        }
Ejemplo n.º 6
0
        public Blog(dynamic entity)
        {
            comments = new Comments();

            Init(entity);
        }
Ejemplo n.º 7
0
        void before_each()
        {
            blogs = new Blogs();

            comments = new Comments();
        }