Exemplo n.º 1
0
 public GetProductsQuery(
     WmTestContext context,
     IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
Exemplo n.º 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");
 }
Exemplo n.º 4
0
 public GetCategoriesQuery(WmTestContext context)
 {
     _context = context;
 }
Exemplo n.º 5
0
 public GetManufacturersQuery(WmTestContext context)
 {
     _context = context;
 }
Exemplo n.º 6
0
 public ProductProfile(WmTestContext context)
 {
     _context = context;
 }
Exemplo n.º 7
0
 public GetSuppliersQuery(WmTestContext context)
 {
     _context = context;
 }
Exemplo n.º 8
0
 public DeleteProductCommand(WmTestContext context)
 {
     _context = context;
 }