private SystemRepository CreateSystemTestRepo(string dbName, bool games = false) { var options = new DbContextOptionsBuilder <VideogamesContext>() .UseInMemoryDatabase(databaseName: dbName) .Options; VideogamesContext SystemContext = new VideogamesContext(options); Systems testsystem = new Systems(); //Check to see if we need to add a game relation to the database if (games == true) { Games testgame = new Games() { Title = "TestGameTitle", Id = 0, SystemName = _SystemName + (_SystemNumber - 1).ToString() }; SystemContext.Games.Add(testgame); SystemContext.SaveChanges(); } for (int i = 0; i < _SystemNumber; i++) { testsystem.SystemName = _SystemName + i.ToString(); testsystem.Id = i; SystemContext.Systems.Add(testsystem); SystemContext.SaveChanges(); } return(new SystemRepository(SystemContext)); }
private YearRepository CreateYearTestRepo(string dbName, bool games = false) { var options = new DbContextOptionsBuilder <VideogamesContext>() .UseInMemoryDatabase(databaseName: dbName) .Options; VideogamesContext YearContext = new VideogamesContext(options); Years testyear = new Years(); //Check to see if we need to add a game relation to the database if (games == true) { Games testgame = new Games() { Title = "TestGameTitle", Id = 0, Year = _YearName + (_YearNumber - 1).ToString() }; YearContext.Games.Add(testgame); YearContext.SaveChanges(); } for (int i = 0; i < _YearNumber; i++) { testyear.Year = _YearName + i.ToString(); testyear.Id = i; YearContext.Years.Add(testyear); YearContext.SaveChanges(); } return(new YearRepository(YearContext)); }
private ManufacturerRepository CreateManufacturerTestRepo(string dbName) { var options = new DbContextOptionsBuilder <VideogamesContext>() .UseInMemoryDatabase(databaseName: dbName) .Options; VideogamesContext ManufacturerContext = new VideogamesContext(options); Manufacturers testmanufacturer = new Manufacturers(); for (int i = 0; i < _ManufacturerNumber; i++) { testmanufacturer.Name = _ManufacturerName + i.ToString(); testmanufacturer.Id = i; ManufacturerContext.Manufacturers.Add(testmanufacturer); ManufacturerContext.SaveChanges(); } return(new ManufacturerRepository(ManufacturerContext)); }
private RatingRepository CreateRatingTestRepo(string dbName) { var options = new DbContextOptionsBuilder <VideogamesContext>() .UseInMemoryDatabase(databaseName: dbName) .Options; VideogamesContext RatingContext = new VideogamesContext(options); Ratings testrating = new Ratings(); for (int i = 0; i < _RatingNumber; i++) { testrating.Rating = _RatingName + i.ToString(); testrating.Id = i; RatingContext.Ratings.Add(testrating); RatingContext.SaveChanges(); } return(new RatingRepository(RatingContext)); }
private GameRepository CreateGameTestRepo(string dbName) { var options = new DbContextOptionsBuilder <VideogamesContext>() .UseInMemoryDatabase(databaseName: dbName) .Options; VideogamesContext GameContext = new VideogamesContext(options); Games testgame = new Games(); for (int i = 0; i < _GameNumber; i++) { testgame.Title = _GameTitle + i.ToString(); testgame.Id = i; testgame.Description = _GameDescription + i.ToString(); testgame.DeveloperName = _GameDeveloper + i.ToString(); GameContext.Games.Add(testgame); GameContext.SaveChanges(); } return(new GameRepository(GameContext)); }
public DeveloperRepository(VideogamesContext context) { _context = context; }
public SystemRepository(VideogamesContext context) { _context = context; }
public RatingRepository(VideogamesContext context) { _context = context; }
public YearRepository(VideogamesContext context) { _context = context; }
public ManufacturerRepository(VideogamesContext context) { _context = context; }
public GameRepository(VideogamesContext context) { _context = context; }
public PublisherRepository(VideogamesContext context) { _context = context; }