protected virtual void AssertThatIndicatorIsCalculated(Expression <Func <HudLightIndicators, StatDto> > expression, string fileName, EnumPokerSites pokerSite, string playerName, decimal expected, int occurredExpected, int couldOccurredExpected, [CallerMemberName] string method = "UnknownMethod") { using (var perfScope = new PerformanceMonitor(method)) { var indicator = new HudLightIndicators(); Playerstatistic playerstatistic = null; var playerStatisticRepository = ServiceLocator.Current.GetInstance <IPlayerStatisticRepository>(); playerStatisticRepository.Store(Arg.Is <Playerstatistic>(x => GetSinglePlayerstatisticFromStoreCall(ref playerstatistic, x, playerName))); FillDatabaseFromSingleFile(fileName, pokerSite); Assert.IsNotNull(playerstatistic, $"Player '{playerName}' has not been found"); indicator.AddStatistic(playerstatistic); var getStat = expression.Compile(); var actualStatDto = getStat(indicator); var expectedStatDto = new StatDto { Value = expected, Occurred = occurredExpected, CouldOccurred = couldOccurredExpected }; AssertionUtils.AssertStatDto(actualStatDto, expectedStatDto); } }
private void LoadPlayerHudStats(ReplayerPlayerViewModel replayerPlayer, ReplayerViewModel replayerViewModel, IList <StatInfo> statInfoCollection) { replayerPlayer.StatInfoCollection.Clear(); HudLightIndicators hudIndicators; if (storageModel.PlayerSelectedItem.Name == replayerPlayer.Name && (short?)storageModel.PlayerSelectedItem.PokerSite == replayerViewModel.CurrentHand.PokersiteId) { hudIndicators = new HudLightIndicators(storageModel.GetStatisticCollection()); } else { hudIndicators = new HudLightIndicators(); playerStatisticRepository .GetPlayerStatistic(replayerPlayer.Name, replayerViewModel.CurrentHand.PokersiteId) .ForEach(stat => hudIndicators.AddStatistic(stat)); } if (hudIndicators != null) { var statList = new List <StatInfo>(); var counter = 0; foreach (var selectedStatInfo in statInfoCollection) { if (selectedStatInfo is StatInfoBreak) { continue; } var statInfo = selectedStatInfo.Clone(); var propertyName = StatsProvider.GetStatProperyName(statInfo.Stat); if (!string.IsNullOrWhiteSpace(propertyName)) { statInfo.AssignStatInfoValues(hudIndicators, propertyName); } replayerPlayer.StatInfoCollection.Add(statInfo); if ((counter + 1) % 4 == 0) { replayerPlayer.StatInfoCollection.Add(new StatInfoBreak()); } counter++; } } }
private void InitSessionStatCollections(HudLightIndicators playerData, Playerstatistic stats) { if (playerData.StatsSessionCollection == null) { playerData.StatsSessionCollection = new Dictionary <Stat, IList <decimal> >(); playerData.AddStatsToSession(stats); } if (playerData.RecentAggList == null) { playerData.RecentAggList = new Common.Utils.FixedSizeList <Tuple <int, int> >(10); playerData.RecentAggList.Add(new Tuple <int, int>(stats.Totalbets, stats.Totalpostflopstreetsplayed)); } }
private void InitSessionCardsCollections(HudLightIndicators playerData, Playerstatistic stats) { if (playerData.CardsList == null) { playerData.CardsList = new Common.Utils.FixedSizeList <string>(4); if (!string.IsNullOrWhiteSpace(stats.Cards)) { playerData.CardsList.Add(stats.Cards); } } if (playerData.ThreeBetCardsList == null) { playerData.ThreeBetCardsList = new Common.Utils.FixedSizeList <string>(4); if (!string.IsNullOrWhiteSpace(stats.Cards) && stats.Didthreebet != 0) { playerData.ThreeBetCardsList.Add(stats.Cards); } } }