コード例 #1
0
        public async Task TotalCommentAsync_ShouldSeeDeletedCommentsTrue_ShouldReturnAllComments()
        {
            // Arrange
            FitStoreDbContext database = this.Database;

            DatabaseHelper.SeedData(database);

            ISupplementService supplementService = new SupplementService(database);

            // Act
            int result = await supplementService.TotalCommentsAsync(firstSupplementId, true);

            // Assert
            result.Should().Be(2);
        }
コード例 #2
0
        public async Task TotalCommentAsync_ShouldSeeDeletedCommentsTrue_ShouldReturnAllFalseComments()
        {
            // Arrange
            FitStoreDbContext database = this.Database;

            DatabaseHelper.SeedData(database);

            database.Comments.Where(c => c.SupplementId == firstSupplementId).FirstOrDefault().IsDeleted = true;
            database.SaveChanges();

            ISupplementService supplementService = new SupplementService(database);

            // Act
            int result = await supplementService.TotalCommentsAsync(firstSupplementId, false);

            // Assert
            result.Should().Be(1);
        }