Esempio n. 1
0
        public void UpdateTest()
        {
            m.Post post = new m.Post();
            post.Title = "UpdateTest Document";
            post.Key = "UpdateTest";
            post.Content = "This is a test document for update.";
            post.Save();

            AssertGoodRead(post, "UpdateTest");

            post.Content = "Change the content for the update test document";
            post.Save();

            AssertGoodRead(post, "UpdateTest");
        }
Esempio n. 2
0
        public void PostWithCommentTest()
        {
            m.Post post = new m.Post();
            post.Key = "PostWithCommentTest";
            post.Title = "Post With Comment Test";
            post.Content = "This is a post that will have comments.";
            post.Save();

            post.Comments = new List<Model.Comment>();

            m.Comment comment = null;

            for (int pass = 1; pass < 4; pass++)
            {
                comment = new m.Comment();
                comment.PostID = post.ID;
                comment.Number = pass;
                comment.Content = string.Format("this is comment number {0}.", pass);
                comment.Save();

                post.Comments.Add(comment);

                AssertGoodRead(comment, comment.ID);
            }
            Assert.IsTrue(post.Comments.Count == 3, "Wrong number of comments in post");

            m.Post readPost = m.Post.Get(post.Key);
            Assert.IsTrue(readPost.Comments.Count == 3, "Wrong number of comments in readPost");
            for (int pass = 1; pass < 4; pass++)
            {
                AssertAreEqual(post.Comments[pass - 1], readPost.Comments[pass - 1]);
            }
        }
Esempio n. 3
0
        public void CreateAndGetTest()
        {
            m.Post post = new m.Post();
            post.Title = "CreateAndGetTest Document";
            post.Key = "CreateAndGetTest";
            post.Content = "This is a test document.";
            post.Save();

            AssertGoodRead(post, "CreateAndGetTest");
        }
Esempio n. 4
0
        public void Setup()
        {
            dm.ExecuteNonQuery("truncate table posts");
            dm.ExecuteNonQuery("truncate table comments");

            m.Post post = new m.Post();
            post.Key = "CorePostForCommentTest";
            post.Title = "Core Post For Comment Test";
            post.Content = "This is some content for the core post.";
            post.Save(); // this post has id 1
            Assert.IsTrue(post.ID == 1, "Cannot continue with tests.  Something wrong with core post.");
        }