public ProductsControllerTest()
        {
            var context = new DbContextDrugStore(dbContextOptions);

            db = new DbInitializeProduct();
            db.Initial(context);

            service = new ProductService(context);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }
Exemple #5
0
 public ClientService(DbContextDrugStore context)
 {
     _context = context;
 }
Exemple #6
0
 public ProductService(DbContextDrugStore context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
Exemple #7
0
 public LaboratoryService(DbContextDrugStore context)
 {
     _context = context;
 }
Exemple #8
0
 public DeliveryService(DbContextDrugStore context)
 {
     _context = context;
 }
Exemple #9
0
 public OrderService(DbContextDrugStore context)
 {
     _context = context;
 }
Exemple #10
0
 public RoleService(DbContextDrugStore context)
 {
     _context = context;
 }
Exemple #11
0
 public LossesService(DbContextDrugStore context)
 {
     _context = context;
 }
Exemple #12
0
 public CategoryService(DbContextDrugStore context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
Exemple #13
0
        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();
        }
Exemple #14
0
 public int CountRecords(DbContextDrugStore context)
 {
     return(context.Products.Count());
 }
Exemple #15
0
 public UserService(DbContextDrugStore context, IConfiguration config)
 {
     _context = context;
     _config  = config;
 }