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");
            };
        }
示例#2
0
文件: has_many.cs 项目: adamjmoon/Oak
        void before_each()
        {
            seed = new Seed();

            blogs = new Blogs();

            comments = new Comments();
        }
示例#3
0
文件: has_many.cs 项目: eugman/Oak
        void before_each()
        {
            blogs = new Blogs();

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

            comments = new Comments();

            comments.Projection = d => new CommentWithAutoProps(d).InitializeExtensions();
        }
        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();
            };
        }
示例#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");
        }
示例#6
0
文件: Blog.cs 项目: adamjmoon/Oak
        public Blog(dynamic entity)
        {
            comments = new Comments();

            Init(entity);
        }
示例#7
0
        void before_each()
        {
            blogs = new Blogs();

            comments = new Comments();
        }