public void InsertShouldReturnInsertId() { //BoardGamesController boardGames = new BoardGamesController(); System.Data.Entity.Database.SetInitializer(new BoardGameDatabaseInitializer()); BoardGameContext context = new BoardGameContext(); //context.Database.Initialize(true); IBoardGameRepository _boardGame = new BoardGameRepository(context); BoardGame boardGame = new BoardGame() { Id = 0, Name = "Unit Test 01", Year = 2015, Category = "Testing Category", Description = "Description test.", Players = "1-10", Image = "" }; //var request = new IHttpActionResult(); //request = boardGames.PostBoardGame(boardGame); //IHttpActionResult //int id = _boardGame.InsertBoardGame(boardGame); //int id = boardGames.PostBoardGame(boardGame); //Assert.AreNotEqual(0, id); }
public IEnumerable <GameCategory> GetAll() { IEnumerable <GameCategory> gameCategories = null; using (BoardGameContext context = new BoardGameContext()) { gameCategories = context.GameCategories //.Where(x => x.Name.StartsWith("A")) .Select(gameCategory => gameCategory); } return(gameCategories); }
public QBoardSquaresController(BoardGameContext context) { _context = context; }
public QPlayersController(BoardGameContext context) { _context = context; }
public DbService(BoardGameContext context, IMemoryCache cache, MemoryCacheEntryOptions cacheOptions) { _context = context ?? throw new ArgumentNullException($"The {nameof(context)} can not be nuul."); _cache = cache ?? throw new ArgumentNullException($"The {nameof(cache)} can not be nuul."); _cacheOptions = cacheOptions ?? throw new ArgumentNullException($"The {nameof(cacheOptions)} can not be nuul."); }
public BoardSquares(BoardGameContext context) { _context = context; }
public Players(BoardGameContext context) { _context = context; }
public BoardGameService(IMemoryCache cache, BoardGameContext context) { this._cache = cache ?? throw new ArgumentNullException(nameof(cache)); this._context = context ?? throw new ArgumentNullException(nameof(context)); }
public UserService(BoardGameContext db) { this.db = db; }
public GamesController(BoardGameContext db, IBggService bggService) { this.db = db; this.bggService = bggService; }
public GamePlaySessionController(BoardGameContext db) { this.db = db; }
protected override void Seed(BoardGameContext context) { context.BoardGameCategories.AddOrUpdate(x => x.ID, new BoardGameCategory() { ID = 1, Name = "Familijne" }, new BoardGameCategory() { ID = 2, Name = "Imprezowe" }, new BoardGameCategory() { ID = 3, Name = "Ekonomiczne" }, new BoardGameCategory() { ID = 4, Name = "Strategiczne" }, new BoardGameCategory() { ID = 5, Name = "Wojenne" }, new BoardGameCategory() { ID = 6, Name = "Przygodowe" }, new BoardGameCategory() { ID = 7, Name = "Kooperacyjne" }, new BoardGameCategory() { ID = 8, Name = "Gry karciane" }, new BoardGameCategory() { ID = 9, Name = "Gry koœciane" }, new BoardGameCategory() { ID = 10, Name = "Logiczne" }, new BoardGameCategory() { ID = 11, Name = "Wyœcigowe i sportowe" }, new BoardGameCategory() { ID = 12, Name = "Gry dla 1 osoby" }, new BoardGameCategory() { ID = 13, Name = "Gry dla 2 osób" }, new BoardGameCategory() { ID = 14, Name = "Gry podró¿ne" }, new BoardGameCategory() { ID = 15, Name = "Gry plenerowe" }, new BoardGameCategory() { ID = 16, Name = "S³owne i liczbowe" }, new BoardGameCategory() { ID = 17, Name = "Ró¿ne" }, new BoardGameCategory() { ID = 18, Name = "Ze zwierzêtami" }, new BoardGameCategory() { ID = 19, Name = "Gry japoñskie" }, new BoardGameCategory() { ID = 20, Name = "Gry dla doros³ych" }, new BoardGameCategory() { ID = 21, Name = "Edukacyjne" }, new BoardGameCategory() { ID = 22, Name = "Dodatki do gier" } ); context.SaveChanges(); var osadnicyCat = context.BoardGameCategories.Where(x => x.ID == 3 || x.ID == 4).ToList(); var splendorCat = context.BoardGameCategories.Where(x => x.ID == 10 || x.ID == 4).ToList(); var sabotazCat = context.BoardGameCategories.Where(x => x.ID == 8).ToList(); context.BoardGames.AddOrUpdate(x => x.ID, new BoardGame() { ID = 1, Name = "Osadnicy z Catanu", Categories = osadnicyCat, MinNumberOfPlayers = 2, MaxNumberOfPlayers = 4 }, new BoardGame() { ID = 2, Name = "Splendor", Categories = splendorCat, MinNumberOfPlayers = 2, MaxNumberOfPlayers = 4 }, new BoardGame() { ID = 3, Name = "Sabota¿ysta", Categories = sabotazCat, MinNumberOfPlayers = 2, MaxNumberOfPlayers = 6 } ); context.SaveChanges(); var werciaGames = context.BoardGames.Where(x => x.ID == 1 || x.ID == 2).ToList(); var lukaszGames = context.BoardGames.Where(x => x.ID == 3).ToList(); context.Users.AddOrUpdate(x => x.ID, new User() { ID = 1, Login = "******", Password = "******", Games = werciaGames }, new User() { ID = 2, Login = "******", Password = "******", Games = lukaszGames } ); context.SaveChanges(); context.Player.AddOrUpdate(x => x.ID, new Player() { ID = 1, UserID = 1, Points = 90, Ranking = 1 }, new Player() { ID = 2, UserID = 2, Points = 70, Ranking = 2 } ); context.SaveChanges(); var players = context.Player.Where(x => x.ID == 1 || x.ID == 2).ToList(); var boardGame = context.BoardGames.Where(x => x.ID == 1).FirstOrDefault(); context.Play.AddOrUpdate(x => x.ID, new Play() { ID = 1, Date = DateTimeOffset.Now, Players = players, BoardGameID = 1, BoardGame = boardGame, Winner = "werka zwycięzca" } ); context.SaveChanges(); var plays = context.Play.ToList(); context.Statistics.AddOrUpdate(x => x.ID, new Statistic() { ID = 1, Plays = plays } ); context.SaveChanges(); }
public PlayerController(BoardGameContext db) { this.db = db; }
public PurchaseController(BoardGameContext context) { _context = context; }
public GamesController(BoardGameContext context, UserManager <User> userManager, SignInManager <User> signManager) { _context = context; _userManager = userManager; _signManager = signManager; }
public BoardGameController(BoardGameContext context) { _context = context; }
public DbService(BoardGameContext dbContext, IMemoryCache memoryCache, IMapper mapper) { this.dbContext = dbContext ?? throw new ArgumentNullException($"Context {nameof(dbContext)} has null value."); this.memoryCache = memoryCache ?? throw new ArgumentNullException($"Cacche {nameof(memoryCache)} has null value."); this.mapper = mapper ?? throw new ArgumentNullException($"Cacche {nameof(mapper)} has null value."); }