Exemple #1
0
        public void Setup()
        {
            /*var optionsSqlServer = new DbContextOptionsBuilder<BancoContext>()
             * .UseSqlServer("Server=.\\;Database=Banco;Trusted_Connection=True;MultipleActiveResultSets=true")
             * .Options;*/

            var optionsInMemory = new DbContextOptionsBuilder <LibranzasContext>().UseInMemoryDatabase("Libranzas").Options;

            _context = new LibranzasContext(optionsInMemory);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            /*var optionsSqlServer = new DbContextOptionsBuilder<BancoContext>()
             * .UseSqlServer("Server=.\\;Database=Banco;Trusted_Connection=True;MultipleActiveResultSets=true")
             * .Options;*/

            var optionsInMemory = new DbContextOptionsBuilder <LibranzasContext>()
                                  .UseInMemoryDatabase("Banco")
                                  .Options;

            LibranzasContext context = new LibranzasContext(optionsInMemory);
        }
Exemple #3
0
        public void SetUp()
        {
            /*var optionsSqlServer = new DbContextOptionsBuilder<BancoContext>()
             * .UseSqlServer("Server=.\\;Database=Banco;Trusted_Connection=True;MultipleActiveResultSets=true")
             * .Options;*/

            var optionsInMemory = new DbContextOptionsBuilder <LibranzasContext>().UseInMemoryDatabase("Libranzas").Options;

            _context             = new LibranzasContext(optionsInMemory);
            unitOfWork           = new UnitOfWork(_context);
            crearEmpleadoService = new EmpleadoService(unitOfWork);
            var request = new CrearEmpleadoRequest {
                Cedula = "1065840833", Nombre = "Duvan", Salario = 1200000
            };

            crearEmpleadoService.CrearEmpleado(request);
            crearCreditoService = new CreditoService(unitOfWork);
        }
Exemple #4
0
        public void ConsultarEmpledoConCreditosEfTest()
        {
            var optionsSqlServer = new DbContextOptionsBuilder <LibranzasContext>()
                                   .UseSqlServer(@"Server=LAPTOP-GEQ2K9D2\MSSQLSERVER01;Database=Libranzas;Trusted_Connection=True;MultipleActiveResultSets=true")
                                   .Options;
            List <Empleado> empleados = null;

            _context = new LibranzasContext(optionsSqlServer);
            try
            {
                empleados = _context.Empleados.Include(i => i.Creditos).Where(t => t.Cedula == "1065840833").ToList();
                //empleados = _context.Empleado.Include(i => i.Creditos).Where(t => t.Cedula == "1065840833").ToList();
            }
            catch (System.Exception)
            {
                throw;
            }

            Assert.IsNotNull(empleados);
        }
Exemple #5
0
 public CreditoController(LibranzasContext context, IUnitOfWork unitOfWork)
 {
     _unitOfWork    = unitOfWork;
     _context       = context;
     CreditoService = new CreditoService(_unitOfWork);
 }
Exemple #6
0
 //Se Recomienda solo dejar la Unidad de Trabajo
 public EmpleadoController(LibranzasContext context, IUnitOfWork unitOfWork)
 {
     _unitOfWork     = unitOfWork;
     _context        = context;
     empleadoService = new EmpleadoService(_unitOfWork);
 }