示例#1
0
 public GetProductsQuery(
     WmTestContext context,
     IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
示例#2
0
 public UpdateProductCommand(
     WmTestContext context,
     IMapper mapper,
     CreateProductValidation productValidation)
 {
     _context           = context;
     _mapper            = mapper;
     _productValidation = productValidation;
 }
 public CreateProductValidation(WmTestContext context)
 {
     RuleFor(x => x.Name)
     .NotEmpty()
     .Must(name => !context.Products.Any(x => x.Name == name))
     .WithMessage("Name must be unique.");
     RuleFor(x => x.Category)
     .Must(category => context.Categories.Any(x => x.Name == category))
     .WithMessage("Category must exist");
     RuleFor(x => x.Manufacturer)
     .Must(manufacturer => context.Manufacturers.Any(x => x.Name == manufacturer))
     .WithMessage("Manufacturer must exist");
     RuleFor(x => x.Supplier)
     .Must(supplier => context.Suppliers.Any(x => x.Name == supplier))
     .WithMessage("Supplier must exist");
 }
示例#4
0
 public GetCategoriesQuery(WmTestContext context)
 {
     _context = context;
 }
示例#5
0
 public GetManufacturersQuery(WmTestContext context)
 {
     _context = context;
 }
示例#6
0
 public ProductProfile(WmTestContext context)
 {
     _context = context;
 }
示例#7
0
 public GetSuppliersQuery(WmTestContext context)
 {
     _context = context;
 }
示例#8
0
 public DeleteProductCommand(WmTestContext context)
 {
     _context = context;
 }