public void Cannot_add_bonus_template_with_invalid_brand()
        {
            LogInApi(Guid.Empty);
            var walletTemplate = BonusRepository.Brands.Single(b => b.Id == DefaultBrandId).WalletTemplates.Single(wt => wt.IsMain);

            AssertActionIsForbidden(() => ApiProxy.CreateUpdateBonusTemplateAsync(new CreateUpdateTemplate
            {
                Id   = Guid.Empty,
                Info = new CreateUpdateTemplateInfo
                {
                    Name             = TestDataGenerator.GetRandomString(),
                    TemplateType     = BonusType.FirstDeposit,
                    BrandId          = DefaultBrandId,
                    WalletTemplateId = walletTemplate.Id,
                    Mode             = IssuanceMode.AutomaticWithCode
                }
            }));
        }
        public void Cannot_edit_template_with_invalid_brand()
        {
            LogInApi(Guid.Empty);
            var template = CreateFirstDepositTemplate();

            AssertActionIsForbidden(() => ApiProxy.CreateUpdateBonusTemplateAsync(new CreateUpdateTemplate
            {
                Id      = template.Id,
                Version = 0,
                Info    = new CreateUpdateTemplateInfo
                {
                    Name             = TestDataGenerator.GetRandomString(),
                    TemplateType     = BonusType.FirstDeposit,
                    BrandId          = DefaultBrandId,
                    WalletTemplateId = template.Info.WalletTemplateId,
                    Mode             = IssuanceMode.AutomaticWithCode
                }
            }));
        }
        public async void Can_add_bonus_template()
        {
            var walletTemplate = BonusRepository.Brands.Single(b => b.Id == DefaultBrandId).WalletTemplates.Single(wt => wt.IsMain);
            var result         = await ApiProxy.CreateUpdateBonusTemplateAsync(new CreateUpdateTemplate
            {
                Id   = Guid.Empty,
                Info = new CreateUpdateTemplateInfo
                {
                    Name             = TestDataGenerator.GetRandomString(),
                    TemplateType     = BonusType.FirstDeposit,
                    BrandId          = DefaultBrandId,
                    WalletTemplateId = walletTemplate.Id,
                    Mode             = IssuanceMode.AutomaticWithCode
                }
            });

            result.Should().NotBeNull();
            result.Success.Should().BeTrue();

            result = await ApiProxy.CreateUpdateBonusTemplateAsync(new CreateUpdateTemplate
            {
                Id           = result.Id.Value,
                Version      = result.Version.Value,
                Availability = new CreateUpdateTemplateAvailability()
            });

            result.Should().NotBeNull();
            result.Success.Should().BeTrue();

            result = await ApiProxy.CreateUpdateBonusTemplateAsync(new CreateUpdateTemplate
            {
                Id      = result.Id.Value,
                Version = result.Version.Value,
                Rules   = new CreateUpdateTemplateRules
                {
                    RewardTiers = new List <CreateUpdateRewardTier>
                    {
                        new CreateUpdateRewardTier
                        {
                            CurrencyCode = "CAD",
                            BonusTiers   = new List <CreateUpdateTemplateTier>
                            {
                                new CreateUpdateTemplateTier {
                                    Reward = 27
                                }
                            }
                        }
                    }
                }
            });

            result.Should().NotBeNull();
            result.Success.Should().BeTrue();

            result = await ApiProxy.CreateUpdateBonusTemplateAsync(new CreateUpdateTemplate
            {
                Id       = result.Id.Value,
                Version  = result.Version.Value,
                Wagering = new CreateUpdateTemplateWagering()
            });

            result.Should().NotBeNull();
            result.Success.Should().BeTrue();

            result = await ApiProxy.CreateUpdateBonusTemplateAsync(new CreateUpdateTemplate
            {
                Id           = result.Id.Value,
                Version      = result.Version.Value,
                Notification = new CreateUpdateTemplateNotification()
            });

            result.Should().NotBeNull();
            result.Success.Should().BeTrue();
        }