예제 #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");
            };
        }
예제 #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();
        }
예제 #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();
            };
        }
예제 #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();
        }