예제 #1
0
        public void SavePost_WithValidData_ShouldSaveThePostAndTheItemComments()
        {
            PostDto post = PostHelper.GetPostsDto(1)[0];

            this.sut.SaveOrUpdate(post);

            this.sut.Session.SaveChanges();

            post.Id.Should().Be.GreaterThan(0);

            Post postEntity = this.sut.Session
                              .Include <Post>(x => x.CommentsId)
                              .Load <Post>(post.Id);

            postEntity.Should().Not.Be.Null();
            postEntity.Title.Should().Be.EqualTo(post.Title);
            post.Slug.Should().Not.Be.Null();

            ItemComments itemComments = this.sut.Session.Load <ItemComments>(postEntity.CommentsId);

            itemComments.Should().Not.Be.Null();
        }