Пример #1
0
        public void MakeATempDb()
        {
            //---------------Set up test pack-------------------
            var db       = CreateTempDb();
            var migrator = new DbSchemaImporter(db.ConnectionString, TestResources.dbscript);

            migrator.MigrateToLatest();
            Console.WriteLine(db.DatabasePath);
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------

            //---------------Test Result -----------------------
        }
Пример #2
0
        public void MigrateToLatest_ShouldNotThrow()
        {
            using (var db = CreateTempDb())
            {
                //---------------Set up test pack-------------------
                var migrator = new DbSchemaImporter(db.ConnectionString, TestResources.dbscript);

                //---------------Assert Precondition----------------

                //---------------Execute Test ----------------------
                migrator.MigrateToLatest();

                //---------------Test Result -----------------------
            }
        }
 private void ExpectScriptsCanSupportDatabase(IEnumerable <string> result)
 {
     using (var db = new TempDBLocalDb())
     {
         var migrator = new DbSchemaImporter(
             db.ConnectionString,
             string.Join("\r\n", result)
             );
         migrator.MigrateToLatest();
         var cow = RandomValueGen.GetRandom <Cow>();
         using (var ctx = new MooContext(db.CreateConnection()))
         {
             ctx.Cows.Add(cow);
             ctx.SaveChanges();
         }
         using (var ctx = new MooContext(db.CreateConnection()))
         {
             var allCows = ctx.Cows.ToArray();
             Expect(allCows).To.Contain.Exactly(1).Item();
             var stored = allCows[0].DuckAs <ICow>();
             Expect(cow.DuckAs <ICow>()).To.Deep.Equal(stored);
         }
     }
 }
 public void MigrateToLatest()
 {
     _schemaImporter.MigrateToLatest();
     _migrationsRunner.MigrateToLatest();
 }