Ejemplo n.º 1
0
        public void ChallengeScoreboard_Constructor_ShouldHaveCount(Dictionary <UserId, decimal?> scoreboard, int winnerCount, int loserCount)
        {
            // Arrange
            var factory       = new ChallengePayoutFactory();
            var instance      = factory.CreateInstance();
            var entries       = scoreboard.Count;
            var payoutEntries = entries / 2;

            // Act
            var challengeScoreboard = new ChallengeScoreboard(
                instance.GetChallengePayout(new ChallengePayoutEntries(payoutEntries), new EntryFee(100, CurrencyType.Money)),
                scoreboard);

            // Assert
            challengeScoreboard.Winners.Should().HaveCount(winnerCount);
            challengeScoreboard.Losers.Should().HaveCount(loserCount);
        }
Ejemplo n.º 2
0
        public void Close_DomainEvents_ShouldHaveCountOfParticipantWithScore(Dictionary <UserId, decimal?> scoreboard)
        {
            // Arrange
            var factory  = new ChallengePayoutFactory();
            var instance = factory.CreateInstance();

            var challenge = new Challenge(
                new ChallengeId(),
                instance.GetChallengePayout(new ChallengePayoutEntries(scoreboard.Count / 2), new EntryFee(100, CurrencyType.Money)));

            var challengeScoreboard = new ChallengeScoreboard(challenge.Payout, scoreboard);
            var participantCount    = scoreboard.Count(participant => participant.Value != null);

            // Act
            challenge.Close(challengeScoreboard);

            // Assert
            challenge.DomainEvents.Where(domainEvent => domainEvent is ChallengeParticipantPayoutDomainEvent).Should().HaveCount(participantCount);
        }