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++; } } }