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

            DatabaseHelper.SeedData(database);

            database.Supplements.Find(1).IsDeleted      = true;
            database.Comments.Find(commentId).IsDeleted = true;
            database.SaveChanges();

            IModeratorCommentService moderatorCommentService = new ModeratorCommentService(database);

            // Act
            string result = await moderatorCommentService.RestoreAsync(commentId);

            // Assert
            result.Should().Be(string.Format(EntityNotExists, SupplementEntity));
        }
コード例 #2
0
        public async Task RestoreAsync_WithCommentId_ShouldRestoreComment()
        {
            // Arrange
            FitStoreDbContext database = this.Database;

            DatabaseHelper.SeedData(database);

            database.Supplements.Find(10).IsDeleted     = false;
            database.Comments.Find(commentId).IsDeleted = true;
            database.SaveChanges();

            IModeratorCommentService moderatorCommentService = new ModeratorCommentService(database);

            // Act
            string result = await moderatorCommentService.RestoreAsync(commentId);

            // Assert
            result.Should().Be(string.Empty);
            database.Comments.Find(commentId).IsDeleted.Should().Be(false);
        }