Ejemplo n.º 1
0
        public static OncologiaDbContext Create()
        {
            var options = new DbContextOptionsBuilder <OncologiaDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString())
                          .Options;

            var context = new OncologiaDbContext(options);

            context.Database.EnsureCreated();

            context.Pacientes.AddRange(new[] {
                new Paciente {
                    PacienteId = 1000, PrimerNombre = "Adam", PrimerApellido = "Cogan"
                },
                new Paciente {
                    PacienteId = 1001, PrimerNombre = "Jason", PrimerApellido = "Taylor"
                },
                new Paciente {
                    PacienteId = 1002, PrimerNombre = "Brendan", PrimerApellido = "Richards"
                },
            });

            context.SaveChanges();

            return(context);
        }
Ejemplo n.º 2
0
        public static void InitializeDbForTests(OncologiaDbContext context)
        {
            var paciente = new Paciente {
                PrimerNombre     = "Daniel"
                , PrimerApellido = "Aguilar"
                , TipoCedula     = "CE"
                , Cedula         = "1028999"
            };

            context.Pacientes.Add(paciente);

            context.SaveChanges();
        }