Add GenerateSku Tests

This commit is contained in:
lumijiez
2025-05-06 14:19:07 +03:00
parent 1488845fa4
commit ce452e0df4
7 changed files with 197 additions and 2 deletions

View File

@@ -83,7 +83,7 @@ public class CreateProductCommandHandler(
return productDto;
}
private static string GenerateSku(string productName, string? color, string? size)
public static string GenerateSku(string productName, string? color, string? size)
{
var prefix = productName.Length >= 3 ? productName[..3].ToUpper() : productName.ToUpper();
var colorPart = !string.IsNullOrEmpty(color) ? color[..Math.Min(3, color.Length)].ToUpper() : "XXX";

View File

@@ -3,7 +3,7 @@ using Printbase.Infrastructure.DbEntities.Products;
namespace Printbase.Infrastructure.Database;
public class ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : DbContext(options)
public class ApplicationDbContext(DbContextOptions<ApplicationDbContext>? options) : DbContext(options)
{
public DbSet<ProductDbEntity> Products { get; set; } = null!;
public DbSet<ProductVariantDbEntity> ProductVariants { get; set; } = null!;