public void HandleTestThrowsOverflowException477() { LookupGamePlayersDto lookupGamePlayersDto; GetPlayerStatisticsDto getPlayerStatisticsDto; FakeQueryDataStore fakeQueryDataStore; GameDeletedEvent gameDeletedEvent; lookupGamePlayersDto = new LookupGamePlayersDto(); lookupGamePlayersDto.GameId = default(Guid); lookupGamePlayersDto.PlayerName = (string)null; lookupGamePlayersDto.Placing = 0; lookupGamePlayersDto.Winnings = 1065353216; lookupGamePlayersDto.PayIn = -1909903360; getPlayerStatisticsDto = new GetPlayerStatisticsDto(); getPlayerStatisticsDto.PlayerName = (string)null; getPlayerStatisticsDto.GamesPlayed = 0; getPlayerStatisticsDto.Winnings = 0; getPlayerStatisticsDto.PayIn = 0; getPlayerStatisticsDto.Profit = 827772928; getPlayerStatisticsDto.ProfitPerGame = 0; fakeQueryDataStore = new FakeQueryDataStore(); gameDeletedEvent = new GameDeletedEvent(); GetPlayerStatisticsHandler s0 = new GetPlayerStatisticsHandler(); ((BaseHandler)s0).QueryDataStore = (IQueryDataStore)fakeQueryDataStore; LookupGamePlayersDto[] lookupGamePlayersDtos = new LookupGamePlayersDto[2]; GetPlayerStatisticsDto[] getPlayerStatisticsDtos = new GetPlayerStatisticsDto[1] ; lookupGamePlayersDtos[0] = lookupGamePlayersDto; lookupGamePlayersDtos[1] = lookupGamePlayersDto; getPlayerStatisticsDtos[0] = getPlayerStatisticsDto; this.HandleTest (s0, gameDeletedEvent, lookupGamePlayersDtos, getPlayerStatisticsDtos); }
public void HandleTest( [PexAssumeUnderTest] GetPlayerStatisticsHandler target, GameDeletedEvent e, LookupGamePlayersDto[] lookupGamePlayers, GetPlayerStatisticsDto[] getPlayerStatistics ) { // assume PexAssume.IsNotNull(lookupGamePlayers); PexAssume.IsTrue(lookupGamePlayers.Length == 2); PexAssume.IsNotNull(lookupGamePlayers[0]); PexAssume.IsNotNull(lookupGamePlayers[1]); PexAssume.IsNotNull(getPlayerStatistics); PexAssume.IsTrue(getPlayerStatistics.Length == 1); PexAssume.IsNotNull(getPlayerStatistics[0]); PexAssume.IsTrue(lookupGamePlayers[0].PlayerName == getPlayerStatistics[0].PlayerName); // arrange foreach (var lookupGamePlayer in lookupGamePlayers) { target.QueryDataStore.Insert <LookupGamePlayersDto>(lookupGamePlayer); } target.QueryDataStore.Insert <GetPlayerStatisticsDto>(getPlayerStatistics[0]); // act target.Handle(e); // assert var playerStats = target.QueryDataStore.GetData <GetPlayerStatisticsDto>().Single(); PexObserve.ValueAtEndOfTest("playerStats", playerStats); }
public void Delete(int id) { GameDeletedEvent?.Invoke(id); _gameDbController.Delete(id); _logger.LogInformation($"{id}"); }
public void Handle(GameDeletedEvent e) { var games = QueryDataStore.GetData <GetPlayerGamesDto>().Where(x => x.GameId == e.AggregateId).ToList(); foreach (var g in games) { QueryDataStore.Delete <GetPlayerGamesDto>(g); } }
public void Handle(GameDeletedEvent e) { var dtos = QueryDataStore.GetData <GetGamesWithPlayerDto>().Where(x => x.GameId == e.AggregateId).ToList(); foreach (var d in dtos) { QueryDataStore.Delete <GetGamesWithPlayerDto>(d); } }
public void HandleTest872() { LookupGamePlayersDto lookupGamePlayersDto; GetPlayerStatisticsDto getPlayerStatisticsDto; FakeQueryDataStore fakeQueryDataStore; GameDeletedEvent gameDeletedEvent; using (IPexObserveContext observer = PexObserve.NewTest()) { Guid s0 = new Guid (default(int), (short)32, (short)32, default(byte), default(byte), default(byte), default(byte), default(byte), default(byte), default(byte), default(byte)); lookupGamePlayersDto = new LookupGamePlayersDto(); lookupGamePlayersDto.GameId = s0; lookupGamePlayersDto.PlayerName = (string)null; lookupGamePlayersDto.Placing = 0; lookupGamePlayersDto.Winnings = 0; lookupGamePlayersDto.PayIn = 0; getPlayerStatisticsDto = new GetPlayerStatisticsDto(); getPlayerStatisticsDto.PlayerName = (string)null; getPlayerStatisticsDto.GamesPlayed = 0; getPlayerStatisticsDto.Winnings = 0; getPlayerStatisticsDto.PayIn = 0; getPlayerStatisticsDto.Profit = 0; getPlayerStatisticsDto.ProfitPerGame = 0; fakeQueryDataStore = new FakeQueryDataStore(); gameDeletedEvent = new GameDeletedEvent(); GetPlayerStatisticsHandler s1 = new GetPlayerStatisticsHandler(); ((BaseHandler)s1).QueryDataStore = (IQueryDataStore)fakeQueryDataStore; LookupGamePlayersDto[] lookupGamePlayersDtos = new LookupGamePlayersDto[2]; GetPlayerStatisticsDto[] getPlayerStatisticsDtos = new GetPlayerStatisticsDto[1]; lookupGamePlayersDtos[0] = lookupGamePlayersDto; lookupGamePlayersDtos[1] = lookupGamePlayersDto; getPlayerStatisticsDtos[0] = getPlayerStatisticsDto; this.HandleTest (s1, gameDeletedEvent, lookupGamePlayersDtos, getPlayerStatisticsDtos); Assert.IsNotNull((object)s1); Assert.IsNotNull(((BaseHandler)s1).QueryDataStore); GetPlayerStatisticsDto ovplayerStats = observer.GetObservedValue <GetPlayerStatisticsDto>("playerStats"); Assert.IsNotNull((object)ovplayerStats); Assert.AreEqual <string>((string)null, ovplayerStats.PlayerName); Assert.AreEqual <int>(0, ovplayerStats.GamesPlayed); Assert.AreEqual <int>(0, ovplayerStats.Winnings); Assert.AreEqual <int>(0, ovplayerStats.PayIn); Assert.AreEqual <int>(0, ovplayerStats.Profit); Assert.AreEqual <double>(0, ovplayerStats.ProfitPerGame); } }
public void Handle(GameDeletedEvent e) { var players = QueryDataStore.GetData <LookupGamePlayersDto>().Where(x => x.GameId == e.AggregateId); foreach (var p in players) { var stats = QueryDataStore.GetData <GetPlayerStatisticsDto>().First(x => x.PlayerName == p.PlayerName); stats.GamesPlayed--; stats.Winnings -= p.Winnings; stats.PayIn -= p.PayIn; stats.Profit -= p.Winnings - p.PayIn; stats.ProfitPerGame = stats.Profit == 0 ? 0 : stats.Profit / stats.GamesPlayed; QueryDataStore.SaveChanges(); } }
public void Handle(GameDeletedEvent e) { var gameDto = QueryDataStore.GetData <GameLookupDto>().Single(x => x.GameId == e.GameId); if (!gameDto.Completed) { return; } var gamePlayersDto = QueryDataStore.GetData <GamePlayersLookupDto>().Where(x => x.GameId == e.GameId).ToList(); foreach (var player in gamePlayersDto) { var dto = QueryDataStore.GetData <GetPlayersDto>().Single(x => x.PlayerId == player.PlayerId); dto.GamesPlayed--; QueryDataStore.Update(dto); } }
public void Handle(GameDeletedEvent e) { var dto = QueryDataStore.GetData <GetGamesListDto>().Single(d => d.GameId == e.GameId); QueryDataStore.Delete(dto); }
public void Handle(GameDeletedEvent e) { var dto = QueryDataStore.GetData <GetGamesListDto>().Single(x => x.GameId == e.AggregateId); QueryDataStore.Delete <GetGamesListDto>(dto); }
public void Handle(GameDeletedEvent e) { var dto = QueryDataStore.GetData <GetGameCountByDateDto>().Single(d => d.GameId == e.AggregateId); QueryDataStore.Delete <GetGameCountByDateDto>(dto); }