//
        // GET: /Topic/Create

        public ViewResult Create(Guid forumId)
        {
            var topic = new Topic {Forum = _forumRepository.FindBy(forumId)};

            var input = new TopicToInputMapper(_forumRepository).Map(topic);

            return View(input);
        }
 private void TopicWith_PostsAnd_Attachments(int postCount, int attachmentCount)
 {
     _topic = TopicFixtures.TopicWithNoPostsAndNoAttachments(1);
     for (var i = 0; i < postCount; i++)
     {
         _topic.Add(PostFixtures.RootPostWithNoChildren(i));
     }
     for (var i = 0; i < attachmentCount; i++)
     {
         _topic.Add(AttachmentFixtures.Attachment(i));
     }
 }
        private void TopicIs_(string action)
        {
            switch (action)
            {
                case Loaded:
                    _topic = Session.Load<Topic>(_topicId);
                    break;

                case Saved:
                    Session.SaveOrUpdate(_topic);
                    Assert.That(Session.IsDirty());
                    Session.Flush();
                    _topicId = _topic.Id;
                    break;

                case Modified:
                    _topic.Title = string.Format("{0} {1}", _topic.Title, Modified);
                    _topic.Body = string.Format("{0} {1}", _topic.Body, Modified);
                    _topic.Closed = !_topic.Closed;
                    _topic.Sticky = !_topic.Sticky;
                    break;

                case Deleted:
                    Session.Delete(_topic);
                    Assert.That(Session.IsDirty());
                    Session.Flush();
                    break;
            }
        }
 private void TopicWith_PostsAnd_Attachments(int postCount, int attachmentCount)
 {
     _topic = TopicFixtures.TopicWithNoPostsAndNoAttachments(1);
     if (postCount > 0) 
     {
         _PostsAddedToTopic(postCount);
     }
     if (attachmentCount > 0)
     {
         _AttachmentsAddedToTopic(attachmentCount);
     }
 }
Example #5
0
 public virtual void Remove(Topic topic)
 {
     topic.Forum = null;
     _topics.Remove(topic);
 }
Example #6
0
 public virtual void Add(Topic topic)
 {
     topic.Forum = this;
     _topics.Add(topic);
 }
Example #7
0
 public virtual bool Equals(Topic other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return base.Equals(other) && Equals(other.Title, Title);
 }