public ProductsControllerTest() { var context = new DbContextDrugStore(dbContextOptions); db = new DbInitializeProduct(); db.Initial(context); service = new ProductService(context); }
public CategoryControllerTest() { var context = new DbContextDrugStore(dbContextOptions); DbInitialize db = new DbInitialize(); db.Initial(context); // corregir o arreglar esto para adaptar el IMapper : PENDIENTE //service = new CategoryService(context); }
public void Initial(DbContextDrugStore context) { context.Categories.AddRange( new Category() { Name = "Generico", Description = "productos de caracter generico", Condition = true }, new Category() { Name = "Comercial", Description = "productos de caracter comercial", Condition = true } ); context.SaveChanges(); }
public async void Create_ValidObjectPassed_ReturnedResponseHasCreatedItem() { // Arrange var controller = new ProductController(service); CreateProduct addManager = new CreateProduct(); var productAdd = addManager.add(); //context var context = new DbContextDrugStore(dbContextOptions); // Act var resultOk = await controller.Create(productAdd); var records = db.CountRecords(context); var Allproducts = await controller.List(); // Assert var AllresultsList = Allproducts.Should().BeAssignableTo <IEnumerable <ProductViewModel> >().Subject; AllresultsList.Should().HaveCount(records); }
public ClientService(DbContextDrugStore context) { _context = context; }
public ProductService(DbContextDrugStore context, IMapper mapper) { _context = context; _mapper = mapper; }
public LaboratoryService(DbContextDrugStore context) { _context = context; }
public DeliveryService(DbContextDrugStore context) { _context = context; }
public OrderService(DbContextDrugStore context) { _context = context; }
public RoleService(DbContextDrugStore context) { _context = context; }
public LossesService(DbContextDrugStore context) { _context = context; }
public CategoryService(DbContextDrugStore context, IMapper mapper) { _context = context; _mapper = mapper; }
public void Initial(DbContextDrugStore context) { // saved categories context.Categories.AddRange( new Category() { Name = "Generico", Description = "productos de caracter generico", Condition = true }, new Category() { Name = "Comercial", Description = "productos de caracter comercial", Condition = true } ); context.SaveChanges(); // Saved Laboratories context.Laboratories.AddRange( new Laboratory() { LaboratoryName = "Bayer", Description = "Bayer es una compañía de innovación que investiga" + " en las áreas de Ciencias de la Vida centradas en la " + "salud y la agricultura.", Condition = true }, new Laboratory() { LaboratoryName = "Tecnoquimicas", Description = "Somos un grupo empresarial colombiano de reconocido liderazgo en la " + "industria farmacéutica y de consumo masivo, comprometido desde hace más " + "de 80 años con el crecimiento económico y el avance social de nuestro país", Condition = true }, new Laboratory() { LaboratoryName = "Genfar", Description = "Genfar es una empresa que creció con el compromiso de fabricar y llevar " + "medicamentos de calidad a cada vez más personas", Condition = true }, new Laboratory() { LaboratoryName = "Sanofi", Description = "ofrecemos soluciones de salud innovadoras en una amplia gama de afecciones " + "de salud: ya sea una afección común como un resfriado, alergias, problemas " + "digestivos o afecciones graves tales como el cáncer o la esclerosis múltiple;", Condition = true } ); context.SaveChanges(); context.Products.AddRange( new Product() { IdCategory = 1, IdLaboratory = 2, ProductName = "Acetaminofen", BarCode = "sdfsdf", Indicative = "tabletas, 3 al dia", Stock = 100, UnitPrice = 800, SalePrice = 1000, Condition = true }, new Product() { IdCategory = 1, IdLaboratory = 1, ProductName = "Trimebutina", BarCode = "sdfsdf", Indicative = "tabletas", Stock = 10, UnitPrice = 3000, SalePrice = 4000, Condition = true } ); context.SaveChanges(); }
public int CountRecords(DbContextDrugStore context) { return(context.Products.Count()); }
public UserService(DbContextDrugStore context, IConfiguration config) { _context = context; _config = config; }