public void add_valid_item_to_db()
        {
            Init();
            // TEST: add new Admins with good data to db
            try
            {
                Admins.Add(item_with_valid_data);
            }
            catch (Exception ex)
            {
                Assert.Fail($"Failed TEST: add_good_item_to_db: {ex}");
            }
            bool result = false;

            using (cap01devContext db = new cap01devContext())
            {
                foreach (Admins a in db.Admins)
                {
                    if (a.Email == item_with_valid_data.Email)
                    {
                        result = true;
                        break;
                    }
                }
            }
            Assert.IsTrue(result);
        }
Exemplo n.º 2
0
 private void Init()
 {
     if (db == null)
     {
         var optionsBuilder = new DbContextOptionsBuilder <cap01devContext>();
         optionsBuilder = optionsBuilder.UseNpgsql(Configuration["DatabaseConnectionString"]);
         db             = new cap01devContext(optionsBuilder.Options);
     }
     Admins.Clear(db);
 }
 private void Init()
 {
     Settings.Instance = new Settings()
     {
         DbConnectionString = Configuration["DatabaseConnectionString"]
     };
     using (cap01devContext db = new cap01devContext())
     {
         foreach (Admins a in db.Admins)
         {
             db.Remove <Admins>(a);
         }
         db.SaveChanges();
     }
 }
Exemplo n.º 4
0
 public PhotosController(cap01devContext context)
 {
     _context = context;
 }
Exemplo n.º 5
0
 public AdminsController(cap01devContext context)
 {
     db = context;
 }
Exemplo n.º 6
0
 public ParticipantsController(cap01devContext context)
 {
     _context = context;
 }
Exemplo n.º 7
0
 public SchoolsController(cap01devContext context)
 {
     _context = context;
 }
Exemplo n.º 8
0
 public TournamentsController(cap01devContext context)
 {
     _context = context;
 }