public ModificationFunctionsEndToEndTests() { // force database initialization, we don't want this to happen inside transaction using (var context = new GearsOfWarStoredProceduresContext()) { context.Database.Delete(); context.Weapons.Count(); } using (var context = new ArubaStoredProceduresContext()) { context.Database.Delete(); context.Configs.Count(); } using (var context = new FantasyStoredProceduresContext()) { context.Database.Delete(); context.Creatures.Count(); } }
public void Update_Aruba_entities_using_stored_procedures() { ExtendedSqlAzureExecutionStrategy.ExecuteNew( () => { using (new TransactionScope()) { using (var context = new ArubaStoredProceduresContext()) { var allTypes = context.AllTypes.OrderBy(a => a.c1_int).First(); var bug = context.Bugs.OrderBy(a => a.Id).First(); var config = context.Configs.OrderBy(a => a.Id).First(); var owner = context.Owners.OrderBy(o => o.Id).First(); var person = context.People.OrderBy(p => p.Id).First(); var run = context.Runs.OrderBy(r => r.Id).First(); var task = context.Tasks.OrderBy(t => t.Id).ThenBy(t => t.Name).First(); allTypes.c10_float = 12.5; allTypes.c13_varchar_512_ = "Wenn ist das Nunstück git und Slotermeyer?"; allTypes.c28_date = new DateTime(2012, 12, 22); context.SaveChanges(); bug.Number = 42; bug.Resolution = ArubaBugResolution.WontFix; context.SaveChanges(); config.Lang = "Hungarian"; config.OS = "Win8"; context.SaveChanges(); owner.FirstName = "Baltazar"; owner.LastName = "Gabka"; context.SaveChanges(); person.Name = "Don Pedro"; context.SaveChanges(); run.Name = "5K"; context.SaveChanges(); task.TaskInfo = new ArubaTaskInfo { Failed = 12, Improvements = 34, Investigates = 56, Passed = 78, }; context.SaveChanges(); } using (var context = new ArubaStoredProceduresContext()) { var allTypes = context.AllTypes.OrderBy(a => a.c1_int).First(); var bug = context.Bugs.OrderBy(a => a.Id).First(); var config = context.Configs.OrderBy(a => a.Id).First(); var owner = context.Owners.OrderBy(o => o.Id).First(); var person = context.People.OrderBy(p => p.Id).First(); var run = context.Runs.OrderBy(r => r.Id).First(); var task = context.Tasks.OrderBy(t => t.Id).ThenBy(t => t.Name).First(); Assert.Equal(12.5, allTypes.c10_float); Assert.Equal("Wenn ist das Nunstück git und Slotermeyer?", allTypes.c13_varchar_512_); Assert.Equal(new DateTime(2012, 12, 22), allTypes.c28_date); Assert.Equal(42, bug.Number); Assert.Equal(ArubaBugResolution.WontFix, bug.Resolution); Assert.Equal("Hungarian", config.Lang); Assert.Equal("Win8", config.OS); Assert.Equal("Baltazar", owner.FirstName); Assert.Equal("Gabka", owner.LastName); Assert.Equal("Don Pedro", person.Name); Assert.Equal("5K", run.Name); Assert.Equal(12, task.TaskInfo.Failed); Assert.Equal(34, task.TaskInfo.Improvements); Assert.Equal(56, task.TaskInfo.Investigates); Assert.Equal(78, task.TaskInfo.Passed); } } }); }