private static void TestConfig(string testSql, EnumToLookup enumToLookup)
		{
			Database.SetInitializer(new TestInitializer(enumToLookup));
			using (var context = new MagicContext())
			{
				var roger = new Rabbit { Name = "Roger", TehEars = Ears.Pointy };
				context.PeskyWabbits.Add(roger);
				context.SaveChanges();

				// assert
				context.Database.ExecuteSqlCommand(testSql); // should explode if anything is wrong
			}
		}
Esempio n. 2
0
        public void SetUp()
        {
            // Cleanup after other test runs
            // Using setup rather than teardown to make it easier to inspect the database after running a test.
            using (var context = new MagicContext())
            {
                context.Database.Delete();
            }

            Database.SetInitializer(new TestInitializer(new EnumToLookup()));
            using (var context = new MagicContext())
            {
                var roger = new Rabbit { Name = "Roger", TehEars = Ears.Pointy };
                context.PeskyWabbits.Add(roger);
                context.SaveChanges();
            }
        }