/// <summary> /// ConnectionString kommt aus den appsettings.json /// </summary> public UnitOfWork(ApplicationDbContext dbContext) { _dbContext = dbContext; UserRepository = new UserRepository(_dbContext); GameRepository = new GameRepository(_dbContext); RoundRepository = new RoundRepository(_dbContext); QuestionRepository = new QuestionRepository(_dbContext); AnswerRepository = new AnswerRepository(_dbContext); }
public TestingService(string dbName) { DbContextOptionsBuilder <InMemoryContext> builder = new DbContextOptionsBuilder <InMemoryContext>(); DbContextOptions <InMemoryContext> options = builder.UseInMemoryDatabase(databaseName: dbName).Options; Context = new InMemoryContext(options); Players = new PlayerRepository(Context); Rounds = new RoundRepository(Context); }
public void Setup() { _repo = new RoundRepository(_fakeContext); A.CallTo(() => _fakeContext.Rounds).Returns(A.Fake <DbSet <Round> >(o => o.Implements(typeof(IQueryable <Round>)).Implements(typeof(IDbAsyncEnumerable <Round>))) .SetupData(new List <Round> { new Round() { Id = 1, TeeTime = DateTime.Now.AddDays(-10) } })); }
protected override void SetIndexData() { base.SetIndexData(); var rounds = new RoundRepository().GetFinishedRounds(DataExtensions.UserIsAdmin()); ViewData.Model = rounds.GetEnumerator(); if (rounds.Count() > 0) { ViewBag.FirstRoundID = rounds.First().ID; } }
private int GetBetRoundByDate(DateTime date) { var rounds = RoundRepository.GetAllRounds().ToList(); var CurrentRoundId = 1; foreach (var round in rounds) { if (date < round.StartDate) { return(CurrentRoundId); } CurrentRoundId++; } return(CurrentRoundId); }
public UnitOfWork(DatabaseContext context) { _context = context; AccountRepository = new AccountRepository(_context); ImageRepository = new ImageRepository(_context); BracketRepository = new BracketRepository(_context); CreatureSubmissionRepository = new CreatureSubmissionRepository(_context); UserBracketRepository = new UserBracketRepository(_context); ChatMessageRepository = new ChatMessageRepository(_context); RegistryRepository = new RegistryRepository(_context); RoundRepository = new RoundRepository(_context); MatchupRepository = new MatchupRepository(_context); VoteRepository = new VoteRepository(_context); CreatureRepository = new CreatureRepository(_context); }
protected override void SetIndexData() { base.SetIndexData(); var users = new UserRepository().GetActiveUsers().OrderByDescending(e => e.PointsWonBonus); ViewBag.Users = users.GetEnumerator(); ViewBag.GlobalBetsExpired = new MatchRepository().GlobalBetsExpired(); if (users.Count() > 0) { ViewBag.FirstUserID = users.First().UserID; } var rounds = new RoundRepository().GetFinishedRounds(DataExtensions.UserIsAdmin()); ViewBag.Rounds = rounds.GetEnumerator(); if (rounds.Count() > 0) { ViewBag.FirstRoundID = rounds.First().ID; } }
public LocalService() { Context = new SqliteContext(); Players = new PlayerRepository(Context); Rounds = new RoundRepository(Context); }
public RoundService() { var context = new Entities.ShowWaterCupEntities(); _roundRepository = new RoundRepository(context); }
public WebAppService(SqliteContext context) { Players = new PlayerRepository(context); Rounds = new RoundRepository(context); }
public void Setup() { _repo = new RoundRepository(_context); _idsToDelete = new List <int>(); }
static async Task Main(string[] args) { ICardRepository <Card> cardRepository = new CardRepository <Card>(); IGameRepository <Game> gameRepository = new GameRepository <Game>(); IPlayerRepository <Player> playerRepository = new PlayerRepository <Player>(); IRoundRepository <Round> roundRepository = new RoundRepository <Round>(); HistoryService history = new HistoryService(gameRepository, roundRepository); GameService service = new GameService(gameRepository, playerRepository, roundRepository, cardRepository); #region //var uiViewModel = new GameServiceViewModel { PlayerName = "Scott", BotQuantity = 2 }; //var result = await service.StartGame(uiViewModel); //foreach (var user in result.Users) //{ // Console.WriteLine(user.ToString()); // foreach (var card in user.Cards) // { // Console.WriteLine($"{ card.CardRank} : { card.CardSuit}"); // } // Console.WriteLine("========================"); //} //Console.ReadKey(); //Console.WriteLine("===================SECOND ROUND==================="); //Console.WriteLine("===================SECOND ROUND==================="); //var resultAfteNextRound = await service.StartNextRoundForPlayers(result.Users); //foreach (var user in resultAfteNextRound.Users) //{ // Console.WriteLine(user.ToString()); // foreach (var card in user.Cards) // { // Console.WriteLine($"{ card.CardRank} : { card.CardSuit}"); // } // Console.WriteLine("========================"); //} //Console.ReadKey(); //var final = await service.FinalPointsCount(resultAfteNextRound.Users); //foreach (var user in final.Users) //{ // Console.WriteLine(user.ToString()); // foreach (var card in user.Cards) // { // Console.WriteLine($"{ card.CardRank} : { card.CardSuit}"); // } // Console.WriteLine("========================"); //} #endregion #region try { var query = await history.GetAllRoundsFromParticularGame(100); } catch (Exception e) { Console.WriteLine(e.Message); } //var roundhistory = history.CreateUserHistoryVM(query); //foreach (var round in roundhistory) //{ // Console.WriteLine(round.UserName); // foreach (var card in round.Cards) // { // Console.WriteLine($"{card.CardRank} : {card.CardSuit}"); // } //} #endregion }