public UnitTestPlayersController() { var options = new DbContextOptionsBuilder <FootballApiContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) .Options; context = new FootballApiContext(options); context.Player.Add(new Player { FullName = "Cristiano Ronaldo dos Santos Aveiro", Surname = "Cristiano Ronaldo", Height = 187, Weight = 87, Speed = 95, Finishing = 98, FreeKick = 96, Dribbling = 87, FootballTeamID = 1 }); context.Player.Add(new Player { FullName = "Lionel Messi", Surname = "Leo Messi", Height = 170, Weight = 72, Speed = 94, Finishing = 98, FreeKick = 96, Dribbling = 92, FootballTeamID = 1 }); context.Player.Add(new Player { FullName = "Neymar da Silva Santos Júnior", Surname = "Neymar", Height = 175, Weight = 68, Speed = 90, Finishing = 91, FreeKick = 85, Dribbling = 95, FootballTeamID = 1 }); context.SaveChanges(); playersController = new PlayersController(context); }
public UnitTestTransactionsController() { var options = new DbContextOptionsBuilder <FootballApiContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) .Options; context = new FootballApiContext(options); context.Transaction.Add(new Transaction { PlayerID = 1, LeavingTeamID = 6, ComingTeamID = 1 }); context.Transaction.Add(new Transaction { PlayerID = 1, LeavingTeamID = 1, ComingTeamID = 11 }); context.Transaction.Add(new Transaction { PlayerID = 10, LeavingTeamID = 1, ComingTeamID = 6 }); context.SaveChanges(); transactionsController = new TransactionsController(context); }
public UnitTestFootballTeamsController() { var options = new DbContextOptionsBuilder <FootballApiContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) .Options; context = new FootballApiContext(options); context.FootballTeam.Add(new FootballTeam { Name = "Real Madrid Club de Fútbol", Location = "Madrid", ChampionshipID = 1 }); context.FootballTeam.Add(new FootballTeam { Name = "FC Barcelone", Location = "Barcelone", ChampionshipID = 1 }); context.FootballTeam.Add(new FootballTeam { Name = "Club Atlético de Madrid", Location = "Madrid", ChampionshipID = 1 }); context.SaveChanges(); footballTeamsController = new FootballTeamsController(context); }
public UnitTestStadiumController() { var options = new DbContextOptionsBuilder <FootballApiContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) .Options; context = new FootballApiContext(options); context.Stadium.Add(new Stadium { Name = "Stade Santiago-Bernabéu", NumberOfPlaces = 81044, FootballTeamID = 1 }); context.Stadium.Add(new Stadium { Name = "Allianz Arena", NumberOfPlaces = 75024, FootballTeamID = 16 }); context.Stadium.Add(new Stadium { Name = "Juventus Stadium", NumberOfPlaces = 41507, FootballTeamID = 111 }); context.SaveChanges(); stadiumController = new StadiumController(context); }
public UnitTestChampionshipsController() { // construc var options = new DbContextOptionsBuilder <FootballApiContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) .Options; context = new FootballApiContext(options); context.Championship.Add(new Championship { Name = "LaLiga Santander" }); context.Championship.Add(new Championship { Name = "Premier League" }); context.Championship.Add(new Championship { Name = "Serie A" }); context.SaveChanges(); championshipsController = new ChampionshipsController(context); }