예제 #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);
            }
        }
예제 #2
0
 public static void AssertStatDto(StatDto actual, StatDto expected)
 {
     Assert.Multiple(() =>
     {
         Assert.That(actual.Value, Is.EqualTo(expected.Value), "Value must be equal");
         Assert.That(actual.Occurred, Is.EqualTo(expected.Occurred), "Occurred must be equal");
         Assert.That(actual.CouldOccurred, Is.EqualTo(expected.CouldOccurred), "CouldOccurred must be equal");
     });
 }