示例#1
0
        public void UpdateWith_ListOfPlayers_CalculatesCulumlativePercentages()
        {
            var sut = new ActionSequenceStatisticsSetMock(
                new[] { _stub.Out <IActionSequenceStatistic>() }, _stub.Out <IPercentagesCalculator>());

            var analyzablePokerPlayers = new[] { _stub.Out <IAnalyzablePokerPlayer>() };

            sut.UpdateWith(analyzablePokerPlayers);

            sut.CumulativePercentagesCalculated.ShouldBeTrue();
        }
示例#2
0
        public void CalculateCumulativePercentages_TotalCount1_1_TotalCount2_1_Sets_Perc1_50_Perc2_50()
        {
            const int TotalCount1 = 1;
            const int TotalCount2 = 1;

            ActionSequenceStatisticsSetMock sut = GetStatisticsSetStubWithTwoStatisticsReturningTotalCounts(
                TotalCount1, TotalCount2);

            sut.CalculateCumulativePercentagesInvoke();

            sut.CumulativePercentagesByRow[0].ShouldBeEqualTo(50);
            sut.CumulativePercentagesByRow[1].ShouldBeEqualTo(50);
        }
示例#3
0
        public void UpdateWith_Always_RaisesStatisticsWereUpdatedWithItselfAsArgument()
        {
            var sut = new ActionSequenceStatisticsSetMock(
                new[] { _stub.Out <IActionSequenceStatistic>() }, _stub.Out <IPercentagesCalculator>());

            bool wasRaisedWithCorrectArgument = false;

            sut.StatisticsWereUpdated += arg => wasRaisedWithCorrectArgument = arg == sut;

            sut.UpdateWith(_stub.Out <IEnumerable <IAnalyzablePokerPlayer> >());

            wasRaisedWithCorrectArgument.ShouldBeTrue();
        }
示例#4
0
        public void CalculateCumulativePercentages_Always_InitializesCumulativePercentagesByRowToStatisticsCount()
        {
            var sut = new ActionSequenceStatisticsSetMock(
                new[]
            {
                _stub.Out <IActionSequenceStatistic>(),
                _stub.Out <IActionSequenceStatistic>()
            },
                _stub.Out <IPercentagesCalculator>());

            sut.CalculateCumulativePercentagesInvoke();

            sut.CumulativePercentagesByRow.ShouldHaveCount(2);
        }
示例#5
0
        CalculateCumulativePercentages_TotalCount1_1_TotalCount2_1_TotalCount3_2_Sets_Perc1_25_Perc2_25_Perc3_50()
        {
            const int TotalCount1 = 1;
            const int TotalCount2 = 1;
            const int TotalCount3 = 2;

            IActionSequenceStatistic statisticStub1 = _stub.Setup <IActionSequenceStatistic>()
                                                      .Get(s => s.TotalCounts).Returns(TotalCount1).Out;
            IActionSequenceStatistic statisticStub2 = _stub.Setup <IActionSequenceStatistic>()
                                                      .Get(s => s.TotalCounts).Returns(TotalCount2).Out;
            IActionSequenceStatistic statisticStub3 = _stub.Setup <IActionSequenceStatistic>()
                                                      .Get(s => s.TotalCounts).Returns(TotalCount3).Out;

            var sut = new ActionSequenceStatisticsSetMock(
                new[] { statisticStub1, statisticStub2, statisticStub3 },
                _stub.Out <IPercentagesCalculator>());

            sut.CalculateCumulativePercentagesInvoke();

            sut.CumulativePercentagesByRow[0].ShouldBeEqualTo(25);
            sut.CumulativePercentagesByRow[1].ShouldBeEqualTo(25);
            sut.CumulativePercentagesByRow[2].ShouldBeEqualTo(50);
        }