public void AddingItemsToDatabase() { AppDomain.CurrentDomain.SetData("DataDirectory", Path.Combine(new string[] { System.Environment.GetEnvironmentVariable("QUANTUM"), ConfigurationManager.AppSettings["DataDirectory"] })); ItemDBContext db = new ItemDBContext(); Item item = new Item { ItemText = "Example Item Text" }; db.Items.Add(item); db.SaveChanges(); }
public void BeforeScenario() { _db = new ItemDBContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Items.mdf;Integrated Security=True"); _db.Database.ExecuteSqlCommand("TRUNCATE TABLE Items;"); _db.SaveChanges(); }