Esempio n. 1
0
        public GizmosController(GizmoContext context)
        {
            _context = context;

            if (!_context.Gizmos.Any())
            {
                _context.AddRange(GizmosData.Get());
                _context.SaveChanges();
            }
        }
Esempio n. 2
0
        public GizmosControllerShould()
        {
            var builder = new DbContextOptionsBuilder <GizmoContext>()
                          .UseInMemoryDatabase("Gizmos");
            var context = new GizmoContext(builder.Options);

            if (!context.Gizmos.Any())
            {
                context.AddRange(GizmosData.Get());
                context.SaveChanges();
            }

            _ctx = context;
        }