Exemplo n.º 1
0
        public async Task CanModifyATable()
        {
            using (var cn = GetConnection())
            {
                var init = new DbInitialiser(cn, null);
                await init.InitialiseDatabase(new IMigration[] { new Migration201(), new Migration202() });
            }

            using (var cn = GetConnection())
            {
                var init        = new DbInitialiser(cn, null);
                var columnNames = init.GetColumnNames("Person");
                Assert.AreEqual(4, columnNames.Length);
            }
        }
Exemplo n.º 2
0
 public async Task CanInitializeADatabase()
 {
     using (var cn = GetConnection())
     {
         var init = new DbInitialiser(cn, this.GetType().Assembly);
         await init.InitialiseDatabase();
     }
     using (var cn = GetConnection())
     {
         var init   = new DbInitialiser(cn, this.GetType().Assembly);
         var tables = init.GetTableNames();
         Assert.IsTrue(tables.Contains("Person"));
         Assert.IsTrue(tables.Contains("Stuff"));
     }
 }
Exemplo n.º 3
0
        public async Task CanSeedADatabase()
        {
            using (var cn = GetConnection())
            {
                var init = new DbInitialiser(cn, null);
                await init.InitialiseDatabase(new IMigration[] { new Migration101() });
            }

            using (var cn = GetConnection())
            {
                var people = cn.Query <Migration101.Person>("SELECT * FROM Person");
                Assert.AreEqual(2, people.Count);
                var stuff = cn.Query <Migration101.Stuff>("SELECT * FROM Stuff");
                Assert.AreEqual(4, stuff.Count);
            }
        }