Пример #1
0
        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);
            }
        }