Beispiel #1
0
 public void All_bonuses_are_qualified_if_no_exclude_bonuses_are_selected()
 {
     BonusQueries
     .GetDepositQualifiedBonuses(PlayerId)
     .Count()
     .Should()
     .Be(3);
 }
        public void Qualified_bonuses_list_does_not_contain_inactive_bonuses()
        {
            CreateFirstDepositBonus(mode: IssuanceMode.AutomaticWithCode, isActive: false);

            BonusQueries.GetDepositQualifiedBonuses(PlayerId)
            .ToList()
            .Should()
            .BeEmpty();
        }
Beispiel #3
0
        public void Bonus_is_not_qualified_if_ANY_of_excluded_bonuses_were_redeemed()
        {
            MakeDeposit(PlayerId, bonusCode: _excludedBonus1.Code);

            BonusQueries.GetDepositQualifiedBonuses(PlayerId)
            .ToList()
            .Should()
            .NotContain(qualifiedBonus => qualifiedBonus.Name == _bonus.Name);
        }
Beispiel #4
0
        public void Qualification_of_fraudulent_player_for_bonus_fails()
        {
            CreateFirstDepositBonus(mode: IssuanceMode.AutomaticWithCode);

            DisableBonusesForPlayer(PlayerId);

            var bonuses = BonusQueries.GetDepositQualifiedBonuses(PlayerId);

            bonuses.Should().BeEmpty();
        }
        public void Qualified_bonuses_list_contain_current_bonus_version()
        {
            var bonusManagementCommands = Container.Resolve <BonusManagementCommands>();
            var template = CreateFirstDepositTemplate(mode: IssuanceMode.AutomaticWithCode);
            var now      = DateTimeOffset.Now.ToBrandOffset(template.Info.Brand.TimezoneId).Date;
            var uiModel1 = new CreateUpdateBonus
            {
                Id          = Guid.Empty,
                TemplateId  = template.Id,
                Name        = TestDataGenerator.GetRandomString(),
                Code        = TestDataGenerator.GetRandomString(),
                Description = TestDataGenerator.GetRandomString(),
                ActiveFrom  = now,
                ActiveTo    = now.AddDays(1)
            };
            var bonusId = bonusManagementCommands.AddUpdateBonus(uiModel1);

            bonusManagementCommands.ChangeBonusStatus(new ToggleBonusStatus
            {
                Id       = bonusId,
                IsActive = true
            });
            bonusManagementCommands.ChangeBonusStatus(new ToggleBonusStatus
            {
                Id       = bonusId,
                IsActive = false
            });

            var uiModel2 = new CreateUpdateBonus
            {
                Id          = bonusId,
                Version     = 2,
                TemplateId  = template.Id,
                Name        = TestDataGenerator.GetRandomString(),
                Code        = TestDataGenerator.GetRandomString(),
                Description = TestDataGenerator.GetRandomString(),
                ActiveFrom  = now,
                ActiveTo    = now.AddDays(1)
            };

            bonusManagementCommands.AddUpdateBonus(uiModel2);
            bonusManagementCommands.ChangeBonusStatus(new ToggleBonusStatus
            {
                Id       = bonusId,
                IsActive = true
            });

            BonusQueries
            .GetDepositQualifiedBonuses(PlayerId)
            .Single()
            .Code
            .Should()
            .Be(uiModel2.Code);
        }
        public void Qualified_bonuses_list_does_not_contain_expired_bonuses()
        {
            var bonus = CreateFirstDepositBonus(mode: IssuanceMode.AutomaticWithCode);

            bonus.ActiveFrom = DateTimeOffset.MaxValue;

            BonusQueries.GetDepositQualifiedBonuses(PlayerId)
            .ToList()
            .Should()
            .BeEmpty();
        }
        public void Can_get_qualified_bonuses_list()
        {
            var bonus = CreateFirstDepositBonus(mode: IssuanceMode.AutomaticWithCode);

            BonusQueries.GetDepositQualifiedBonuses(PlayerId)
            .ToList()
            .Single()
            .Name
            .Should()
            .Be(bonus.Name);
        }
Beispiel #8
0
        public void Bonus_is_not_qualified_if_ALL_of_excluded_bonuses_were_redeemed()
        {
            _bonus.Template.Availability.ExcludeOperation = Operation.All;

            MakeDeposit(PlayerId, bonusCode: _excludedBonus1.Code);
            MakeDeposit(PlayerId, bonusCode: _excludedBonus2.Code);

            BonusQueries.GetDepositQualifiedBonuses(PlayerId)
            .ToList()
            .Should()
            .NotContain(qualifiedBonus => qualifiedBonus.Name == _bonus.Name);
        }
Beispiel #9
0
        public void Bonus_is_qualified_if_only_one_of_ALL_excluded_bonuses_were_redeemed()
        {
            _bonus.Template.Availability.ExcludeOperation = Operation.All;

            MakeDeposit(PlayerId, bonusCode: _excludedBonus1.Code);

            BonusQueries
            .GetDepositQualifiedBonuses(PlayerId)
            .Count()
            .Should()
            .Be(3, because: "Only one of excluded bonuses was redeemed.");
        }
Beispiel #10
0
        public int List_does_not_contain_bonuses_for_player_with_invalid_registration_date_range(int registeredDaysAgo)
        {
            var bonus    = CreateFirstDepositBonus(mode: IssuanceMode.AutomaticWithCode);
            var brandNow = DateTimeOffset.Now.ToBrandOffset(bonus.Template.Info.Brand.TimezoneId);

            bonus.Template.Availability.PlayerRegistrationDateFrom = brandNow.AddDays(-2);
            bonus.Template.Availability.PlayerRegistrationDateTo   = brandNow.AddMilliseconds(-1);

            BonusRepository.Players.Single().DateRegistered = brandNow.AddDays(-1 * registeredDaysAgo);

            return(BonusQueries.GetDepositQualifiedBonuses(PlayerId).Count());
        }
Beispiel #11
0
        public int Disqualification_is_processed_based_on_correct_bonus_redemptions(ActivationStatus status)
        {
            BonusRepository
            .Players
            .Single(p => p.Id == PlayerId)
            .Wallets
            .First()
            .BonusesRedeemed.Add(new BonusRedemption
            {
                Bonus           = _excludedBonus1,
                ActivationState = status
            });

            return(BonusQueries.GetDepositQualifiedBonuses(PlayerId).Count(b => b.Name == _bonus.Name));
        }
Beispiel #12
0
        public int Player_Risk_level_qualification(bool riskLevelActive)
        {
            var bonus       = CreateFirstDepositBonus(mode: IssuanceMode.AutomaticWithCode);
            var riskLevelId = bonus.Template.Info.Brand.RiskLevels.Single().Id;

            bonus.Template.Availability.ExcludeRiskLevels = new List <RiskLevelExclude> {
                new RiskLevelExclude {
                    ExcludedRiskLevelId = riskLevelId
                }
            };

            TagPlayerWithFraudRiskLevel(PlayerId, riskLevelId);
            if (riskLevelActive == false)
            {
                DeactivateRiskLevel(riskLevelId);
            }

            return(BonusQueries.GetDepositQualifiedBonuses(PlayerId).Count());
        }
 public List <DepositQualifiedBonus> GetDepositQualifiedBonuses(Guid playerId)
 {
     return(_bonusQueries.GetDepositQualifiedBonuses(playerId).ToList());
 }
 public IEnumerable <DepositQualifiedBonus> GetDepositQualifiedBonuses(Guid playerId, decimal transferAmount)
 {
     return(_bonusQueries.GetDepositQualifiedBonuses(playerId, transferAmount));
 }