public void AddPostToThreadAddToPostsCollection()
 {
     DiscussionThread thread = new DiscussionThread();
     Assert.AreEqual(0, thread.Posts.Count);
     thread.AddPost(new Post());
     Assert.AreEqual(1, thread.Posts.Count);
 }
        public void ThreadPostsPersistenceByReachability()
        {
            Post             post             = new Post();
            DiscussionThread discussionThread = GetThread_Persistent();

            discussionThread.AddPost(post);

            post.Title   = "First Post";
            post.Content = "Content";
            post.Author  = post.Thread.Forum.Manager;

            UnitOfWork.Current.TransactionalFlush();
            UnitOfWork.CurrentSession.Evict(post);
            UnitOfWork.CurrentSession.Evict(discussionThread);

            Post fromDb = Repository <Post> .Get(post.Id);

            Assert.IsNotNull(fromDb);
            Assert.AreNotSame(post, fromDb);

            DiscussionThread threadFromDb = fromDb.Thread;

            Assert.AreNotSame(discussionThread, threadFromDb);
            Assert.AreEqual(discussionThread.Id, threadFromDb.Id);

            Assert.IsTrue(threadFromDb.Posts.Contains(fromDb));
        }
Beispiel #3
0
        public void AddPostToThreadAddToPostsCollection()
        {
            DiscussionThread thread = new DiscussionThread();

            Assert.AreEqual(0, thread.Posts.Count);
            thread.AddPost(new Post());
            Assert.AreEqual(1, thread.Posts.Count);
        }
Beispiel #4
0
        public void AddPostToThreadSetPostThreadToAddedThread()
        {
            DiscussionThread thread = new DiscussionThread();
            Post             post   = new Post();

            Assert.IsNull(post.Thread);
            thread.AddPost(post);
            Assert.AreEqual(thread, post.Thread);
        }
 public void AddPostToThreadSetPostThreadToAddedThread()
 {
     DiscussionThread thread = new DiscussionThread();
     Post post = new Post();
     Assert.IsNull(post.Thread);
     thread.AddPost(post);
     Assert.AreEqual(thread, post.Thread);
    
 }
        public void AddingPostToThreadModifyThreadLastUpdateDate()
        {
            DiscussionThread thread = new DiscussionThread();
            thread.LastUpdated = DateTime.Today.AddDays(-3);

            thread.AddPost(new Post());
            Assert.Between(thread.LastUpdated,
                                     DateTime.Now.AddSeconds(-10),
                                     DateTime.Now.AddSeconds(10)
                          );
        }
Beispiel #7
0
        public void AddingPostToThreadModifyThreadLastUpdateDate()
        {
            DiscussionThread thread = new DiscussionThread();

            thread.LastUpdated = DateTime.Today.AddDays(-3);

            thread.AddPost(new Post());
            Assert.Between(thread.LastUpdated,
                           DateTime.Now.AddSeconds(-10),
                           DateTime.Now.AddSeconds(10)
                           );
        }