Initial commit of LittleShop project (excluding large archives)
- BTCPay Server integration - TeleBot Telegram bot - Review system - Admin area - Docker deployment configuration 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -193,9 +193,10 @@ public class CategoryServiceTests : IDisposable
|
||||
// Assert
|
||||
result.Should().BeTrue();
|
||||
|
||||
// Verify in database
|
||||
// Verify in database - soft delete means IsActive = false
|
||||
var dbCategory = await _context.Categories.FindAsync(categoryId);
|
||||
dbCategory.Should().BeNull();
|
||||
dbCategory.Should().NotBeNull();
|
||||
dbCategory!.IsActive.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -212,7 +213,7 @@ public class CategoryServiceTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DeleteCategoryAsync_WithProductsAttached_ThrowsException()
|
||||
public async Task DeleteCategoryAsync_WithProductsAttached_SoftDeletesCategory()
|
||||
{
|
||||
// Arrange
|
||||
var categoryId = Guid.NewGuid();
|
||||
@@ -240,11 +241,16 @@ public class CategoryServiceTests : IDisposable
|
||||
_context.Products.Add(product);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Act & Assert
|
||||
await Assert.ThrowsAsync<DbUpdateException>(async () =>
|
||||
{
|
||||
await _categoryService.DeleteCategoryAsync(categoryId);
|
||||
});
|
||||
// Act
|
||||
var result = await _categoryService.DeleteCategoryAsync(categoryId);
|
||||
|
||||
// Assert - soft delete should succeed even with products
|
||||
result.Should().BeTrue();
|
||||
|
||||
// Verify category is soft deleted
|
||||
var dbCategory = await _context.Categories.FindAsync(categoryId);
|
||||
dbCategory.Should().NotBeNull();
|
||||
dbCategory!.IsActive.Should().BeFalse();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
||||
Reference in New Issue
Block a user