Exemple #1
0
        public async Task GetByThreadId_ReturnsPost_WhenProvidedValidThreadId()
        {
            // Arrange
            ForumThread thread = new ForumThread
            {
                Title      = "123",
                ForumPosts =
                    new List <ForumPost> {
                    new ForumPost {
                        Content = "test"
                    }
                }
            };

            DbContext.Threads.Add(thread);
            await DbContext.SaveChangesAsync();

            // Act
            IReadOnlyCollection <ForumPost> posts = await _postsRepository.GetByThread(thread.Id);

            // Assert
            Assert.That(posts, Has.Count.EqualTo(1));
        }