public void TestInitialize() { var options = new DbContextOptionsBuilder <f19Context>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; db = new f19Context(options); var studio = new Studio { StudioId = 502, Name = "Some Studio" }; movies.Add(new Movie { MovieId = 11, Title = "Movie One", Year = 2017, Revenue = 100000, Studio = studio }); movies.Add(new Movie { MovieId = 22, Title = "Movie Two", Year = 2018, Revenue = 200000, Studio = studio }); movies.Add(new Movie { MovieId = 33, Title = "Movie Three", Year = 2016, Revenue = 300000, Studio = studio }); movies.Add(new Movie { MovieId = 44, Title = "Movie Four", Year = 2019, Revenue = 400000, Studio = studio }); foreach (var p in movies) { db.Add(p); } db.SaveChanges(); moviesController = new MoviesController(db); }
public void TestInitialize() { var options = new DbContextOptionsBuilder <f19Context>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; db = new f19Context(options); var region = new Region { RegionId = 871, Name = "Oceania" }; destinations.Add(new Destination { DestinationId = 534, Name = "One Cool Place", Location = "South Oz", Region = region }); destinations.Add(new Destination { DestinationId = 535, Name = "Second Cool Place", Location = "West Oz", Region = region }); destinations.Add(new Destination { DestinationId = 536, Name = "Third Cool Place", Location = "North Oz", Region = region }); destinations.Add(new Destination { DestinationId = 537, Name = "Fourth Cool Place", Location = "East Oz", Region = region }); foreach (var d in destinations) { db.Add(d); } db.SaveChanges(); destinationsController = new DestinationsController(db); }