public void Can_change_payment_level()
        {
            //setup
            var brand        = _brandTestHelper.CreateBrand();
            var player       = _playerTestHelper.CreatePlayer();
            var paymentLevel = _paymentTestHelper.CreatePaymentLevel(brand.Id, player.CurrencyCode);

            //act
            _playerCommands.ChangePaymentLevel(new ChangePaymentLevelData
            {
                PlayerId       = player.Id,
                PaymentLevelId = paymentLevel.Id,
                Remarks        = "test"
            });

            //assert
            var playerData = _playerRepository.Players.FirstOrDefault(x => x.Id == player.Id);

            playerData.PaymentLevelId.Should().Be(paymentLevel.Id);

            var playerPaymentLevel = _paymentRepository.PlayerPaymentLevels.FirstOrDefault(x => x.PlayerId == player.Id);

            playerPaymentLevel.PaymentLevel.Id.Should().Be(paymentLevel.Id);

            var eventRepository = Container.Resolve <IEventRepository>();

            eventRepository.Events.Where(x => x.DataType == typeof(PlayerPaymentLevelChanged).Name).Should().NotBeEmpty();
        }
Ejemplo n.º 2
0
        public void Can_assign_brand_product()
        {
            var gamesTestHelper = Container.Resolve <GamesTestHelper>();
            var productId       = gamesTestHelper.CreateGameProvider().Id;
            var brand           = BrandTestHelper.CreateBrand();

            brand.Licensee.Products.Add(new LicenseeProduct
            {
                ProductId = productId
            });

            BrandRepository.SaveChanges();

            BrandCommands.AssignBrandProducts(new AssignBrandProductsData
            {
                BrandId     = brand.Id,
                ProductsIds = new[] { productId }
            });

            brand = BrandQueries.GetBrand(brand.Id);

            var brandProduct = brand.Products.SingleOrDefault(x => x.ProductId == productId);

            Assert.That(brandProduct, Is.Not.Null);
        }
Ejemplo n.º 3
0
        public void Cannot_update_brand_ip_regulation_with_invalid_brand()
        {
            /*** Arrange ***/
            var licensee = BrandTestHelper.CreateLicensee();
            var brand    = BrandTestHelper.CreateBrand(licensee, isActive: true);

            SecurityTestHelper.CreateBrand(brand.Id, brand.LicenseeId, brand.TimezoneId);

            var addBrandIpRegulationData = new AddBrandIpRegulationData
            {
                IpAddress      = TestDataGenerator.GetRandomIpAddress(),
                BrandId        = brand.Id,
                LicenseeId     = licensee.Id,
                BlockingType   = IpRegulationConstants.BlockingTypes.Redirection,
                RedirectionUrl = "google.com"
            };

            _brandService.CreateIpRegulation(addBrandIpRegulationData);

            var editBrandIpRegulationData = Mapper.DynamicMap <EditBrandIpRegulationData>(addBrandIpRegulationData);

            LogWithNewAdmin(Modules.BrandIpRegulationManager, Permissions.Update);

            /*** Act ***/
            Assert.Throws <InsufficientPermissionsException>(() => _brandService.UpdateIpRegulation(editBrandIpRegulationData));
        }
Ejemplo n.º 4
0
        public void Cannot_delete_brand_ip_regulation_with_invalid_brand()
        {
            /*** Arrange ***/
            var licensee = BrandTestHelper.CreateLicensee();
            var brand    = BrandTestHelper.CreateBrand(licensee, isActive: true);

            SecurityTestHelper.CreateBrand(brand.Id, brand.LicenseeId, brand.TimezoneId);

            var ipAddress = TestDataGenerator.GetRandomIpAddress();

            var data = new AddBrandIpRegulationData
            {
                IpAddress      = ipAddress,
                BrandId        = brand.Id,
                LicenseeId     = licensee.Id,
                BlockingType   = IpRegulationConstants.BlockingTypes.Redirection,
                RedirectionUrl = "google.com"
            };

            _brandService.CreateIpRegulation(data);

            var regulation = _brandService.GetIpRegulations().SingleOrDefault(ip => ip.IpAddress == ipAddress);

            LogWithNewAdmin(Modules.BrandIpRegulationManager, Permissions.Delete);

            /*** Act ***/
            Assert.NotNull(regulation);
            Assert.Throws <InsufficientPermissionsException>(() => _brandService.DeleteIpRegulation(regulation.Id));
        }
Ejemplo n.º 5
0
        public void GivenNewDeactivatedBrandIsCreated(string activationStatus)
        {
            var isActive = activationStatus.Equals("activated");
            var licensee = BrandTestHelper.CreateLicensee();

            ScenarioContext.Current.Add("licenseeId", licensee.Id);
            ScenarioContext.Current.Add("brandId", BrandTestHelper.CreateBrand(licensee, isActive: isActive).Id);
        }
Ejemplo n.º 6
0
        protected Admin CreateAdminWithPermissions(string category, string[] permissions)
        {
            var licensee = BrandTestHelper.CreateLicensee();
            var brand    = BrandTestHelper.CreateBrand(licensee, isActive: true);
            var brands   = new[] { brand };

            return(SecurityTestHelper.CreateAdmin(category, permissions, brands));
        }
Ejemplo n.º 7
0
        public void ThenBrandProductBetLevelsAreVisibleToMe()
        {
            var licensee = BrandTestHelper.CreateLicensee();
            var brand    = BrandTestHelper.CreateBrand(licensee, isActive: true);

            var result = AdminApiProxy.GetBrandProductBetLevels(brand.Id, brand.Products.First().ProductId);

            result.Should().NotBeNull();
            result.StatusCode.ShouldBeEquivalentTo(HttpStatusCode.OK);
        }
Ejemplo n.º 8
0
        public void Cannot_edit_vip_level_with_invalid_brand()
        {
            // Arrange
            var brand = BrandTestHelper.CreateBrand();
            var addVipLevelCommand = CreateAddVipLevelCommand(brand);

            LogWithNewAdmin(Modules.VipLevelManager, Permissions.Update);

            // Act
            Assert.Throws <InsufficientPermissionsException>(() => BrandCommands.EditVipLevel(addVipLevelCommand));
        }
Ejemplo n.º 9
0
        public void WhenNewBrandIsCreated(string activationStatus)
        {
            var isActive = activationStatus.Equals("activated");
            var licensee = BrandTestHelper.CreateLicensee();
            var brand    = BrandTestHelper.CreateBrand(licensee, isActive: isActive);

            ScenarioContext.Current.Add("licenseeId", licensee.Id);
            ScenarioContext.Current.Add("brandId", brand.Id);

            SecurityTestHelper.CreateBrand(brand.Id, brand.LicenseeId, brand.TimezoneId);
        }
Ejemplo n.º 10
0
        public void Can_process_brand_updated()
        {
            // Arrange
            var          brand                   = BrandTestHelper.CreateBrand();
            var          newBrandName            = TestDataGenerator.GetRandomString(20);
            var          newBrandCode            = TestDataGenerator.GetRandomString(20);
            var          newTimeZoneId           = TestDataGenerator.GetRandomTimeZone().Id;
            var          newInternalAccountCount = TestDataGenerator.GetRandomNumber(10, 0);
            const string remarks                 = "Test updating brand";

            string newPlayerPrefix;

            do
            {
                newPlayerPrefix = TestDataGenerator.GetRandomString(3);
            }while (_brandQueries.GetBrands()
                    .Any(x => x.PlayerPrefix == newPlayerPrefix && x.Licensee.Id == brand.Licensee.Id));

            // Act
            _brandCommands.EditBrand(new EditBrandRequest
            {
                Brand              = brand.Id,
                Code               = newBrandCode,
                Email              = brand.Email,
                WebsiteUrl         = brand.WebsiteUrl,
                EnablePlayerPrefix = true,
                InternalAccounts   = newInternalAccountCount,
                Licensee           = brand.Licensee.Id,
                SmsNumber          = TestDataGenerator.GetRandomPhoneNumber().Replace("-", ""),
                Name               = newBrandName,
                PlayerPrefix       = newPlayerPrefix,
                TimeZoneId         = newTimeZoneId,
                Type               = brand.Type,
                Remarks            = remarks
            });

            // Assert
            Assert.AreEqual(2, _reportRepository.BrandRecords.Count());
            var record = _reportRepository.BrandRecords.Last();

            Assert.AreEqual(brand.Id, record.BrandId);
            Assert.AreEqual(brand.Licensee.Name, record.Licensee);
            Assert.AreEqual(newBrandCode, record.BrandCode);
            Assert.AreEqual(newBrandName, record.Brand);
            Assert.AreEqual(newPlayerPrefix, record.PlayerPrefix);
            Assert.AreEqual(newInternalAccountCount, record.AllowedInternalAccountsNumber);
            Assert.AreEqual(TimeZoneInfo.GetSystemTimeZones().Single(z => z.Id == newTimeZoneId).DisplayName,
                            record.BrandTimeZone);
            record.Updated.Should().BeCloseTo(brand.DateUpdated.Value);
            Assert.AreEqual(brand.UpdatedBy, record.UpdatedBy);
            Assert.AreEqual(remarks, record.Remarks);
        }
Ejemplo n.º 11
0
        public void GivenNewUserWithSufficientPermissionsIsCreated(string permissionName, string module)
        {
            var permissions = new[] { permissionName };
            var licensee    = BrandTestHelper.CreateLicensee();
            var brand       = BrandTestHelper.CreateBrand(licensee, isActive: true);
            var brands      = new[] { brand };
            var password    = TestDataGenerator.GetRandomString(6);

            var user = SecurityTestHelper.CreateAdmin(module, permissions, brands, password);

            ScenarioContext.Current.Add("username", user.Username);
            ScenarioContext.Current.Add("password", password);
        }
Ejemplo n.º 12
0
        public override void BeforeEach()
        {
            base.BeforeEach();

            //create a brand for a default licensee
            _brandId = _brandTestHelper.CreateBrand(_defaultLicensee, PlayerActivationMethod.Automatic);

            _brandTestHelper.AssignCurrency(_brandId, "CAD");
            var brandQueries = _container.Resolve <BrandQueries>();

            _brand = brandQueries.GetBrandOrNull(_brandId);

            _driver.Logout();
            _dashboardPage = _driver.LoginToAdminWebsiteAsSuperAdmin();
            _dashboardPage.BrandFilter.SelectAll();
        }
Ejemplo n.º 13
0
        public void Can_export_report_data()
        {
            // Arrange
            BrandTestHelper.CreateBrand();

            var filteredRecords = ReportController.FilterAndOrder(
                _reportQueries.GetBrandRecordsForExport(),
                new BrandRecord(),
                "Created", "asc");

            // Act
            var content = Encoding.Unicode.GetString(ReportController.ExportToExcel(filteredRecords));

            // Assert
            Assert.AreNotEqual(content.IndexOf("<table"), -1);
        }
Ejemplo n.º 14
0
        public void ThenBrandProductIsSuccessfullyAssigned()
        {
            var licensee = BrandTestHelper.CreateLicensee();
            var brand    = BrandTestHelper.CreateBrand(licensee, isActive: true);

            var data = new AssignBrandProductModel
            {
                Brand    = brand.Id,
                Products = brand.Products.Select(b => b.BrandId.ToString()).ToArray()
            };

            var result = AdminApiProxy.AssignBrandProduct(data);

            result.Should().NotBeNull();
            result.StatusCode.ShouldBeEquivalentTo(HttpStatusCode.OK);
        }
Ejemplo n.º 15
0
        public override void BeforeAll()
        {
            base.BeforeAll();

            //create a brand for a default licensee
            _brandTestHelper = _container.Resolve <BrandTestHelper>();
            var defaultLicenseeId = _brandTestHelper.GetDefaultLicensee();

            _currency = _brandTestHelper.CreateCurrency("ZAR", "South African Rand");
            _brand    = _brandTestHelper.CreateBrand(defaultLicenseeId, null, null, _currency);

            // create a bank account for the brand
            _paymentTestHelper = _container.Resolve <PaymentTestHelper>();
            _bankAccount       = _paymentTestHelper.CreateBankAccount(_brand.Id, _currency.Code);

            _brandQueries  = _container.Resolve <BrandQueries>();
            _brandCurrency = _brandQueries.GetCurrenciesByBrand(_brand.Id).Select(c => c.Code).First();
        }
Ejemplo n.º 16
0
        public void Can_assign_brand_country()
        {
            var brand = BrandTestHelper.CreateBrand();

            BrandCommands.AssignBrandCountry(new AssignBrandCountryRequest
            {
                Brand     = brand.Id,
                Countries = new [] { Country.Code }
            });

            brand = BrandQueries.GetBrand(brand.Id);

            Assert.That(brand.BrandCountries.Count, Is.EqualTo(1));

            var assignedCountry = brand.BrandCountries.First().Country;

            Assert.That(assignedCountry.Code, Is.EqualTo(Country.Code));
            Assert.That(assignedCountry.Name, Is.EqualTo(Country.Name));
        }
Ejemplo n.º 17
0
        public void Can_process_brand_activated()
        {
            // Arrange
            var brand = BrandTestHelper.CreateBrand();

            // Act
            _brandCommands.ActivateBrand(new ActivateBrandRequest {
                BrandId = brand.Id, Remarks = "Test activating brand"
            });

            // Assert
            Assert.AreEqual(2, _reportRepository.BrandRecords.Count());
            var record = _reportRepository.BrandRecords.Last();

            Assert.AreEqual(brand.Id, record.BrandId);
            Assert.AreEqual(brand.Status.ToString(), record.BrandStatus);
            record.Activated.Value.Should().BeCloseTo(brand.DateActivated.Value, 50);
            Assert.AreEqual(brand.ActivatedBy, record.ActivatedBy);
        }
Ejemplo n.º 18
0
        public override void BeforeAll()
        {
            base.BeforeAll();

            // create a brand for default licensee
            _brandTestHelper = _container.Resolve <BrandTestHelper>();
            var brandQueries = _container.Resolve <BrandQueries>();

            _licensee          = brandQueries.GetLicensees().First(x => x.Name == DefaultLicensee);
            _defaultLicenseeId = brandQueries.GetLicensees().First(x => x.Name == DefaultLicensee).Id;
            _brand             = _brandTestHelper.CreateBrand(_licensee);

            // create a role
            _securityTestHelper = _container.Resolve <SecurityTestHelper>();
            _role = _securityTestHelper.CreateRole(new[] { _defaultLicenseeId });

            // create a user
            _adminData = _securityTestHelper.CreateAdmin(_defaultLicenseeId, new[] { _brand }, new[] { "RMB" }, _userPassword, _role.Id);
        }
Ejemplo n.º 19
0
        public override void BeforeEach()
        {
            base.BeforeEach();

            MessagingRepository     = Container.Resolve <IMessagingRepository>();
            MessageTemplateQueries  = Container.Resolve <IMessageTemplateQueries>();
            MessageTemplateCommands = Container.Resolve <IMessageTemplateCommands>();
            MessageTemplateService  = Container.Resolve <IMessageTemplateService>();
            MessagingTestHelper     = Container.Resolve <MessagingTestHelper>();
            BrandTestHelper         = Container.Resolve <BrandTestHelper>();

            var securityTestHelper = Container.Resolve <SecurityTestHelper>();

            securityTestHelper.PopulatePermissions();
            securityTestHelper.CreateAndSignInSuperAdmin();

            BrandTestHelper.CreateBrand(isActive: true);
            Brand = MessagingRepository.Brands.First();
        }
Ejemplo n.º 20
0
        public void Can_assign_VIP_level_to_player_with_permission()
        {
            var defaultLicenseeId = _brandTestHelper.GetDefaultLicensee();
            var brand             = _brandTestHelper.CreateBrand(defaultLicenseeId, isActive: true);

            _driver.Navigate().Refresh();
            _dashboardPage.BrandFilter.SelectAll();
            // create a user with permissions to view and assign VIP level for a player
            var permissions = new[]
            {
                _securityTestHelper.GetPermission(Permissions.View, Modules.PlayerManager),
                _securityTestHelper.GetPermission(Permissions.Update, Modules.PlayerManager),
                _securityTestHelper.GetPermission(Permissions.AssignVipLevel, Modules.PlayerManager)
            };

            var role = _securityTestHelper.CreateRole(new[] { _defaultLicensee.Id }, permissions);

            Thread.Sleep(5000); //wait for new Role event proceeds.
            WaitHelper.WaitUntil(() => _securityTestHelper.IsRoleExistInDb(role.Id));
            const string password = "******";
            var          user     = _securityTestHelper.CreateAdmin(_defaultLicensee.Id, new[] { brand }, password: password, roleId: role.Id);

            // create a player
            var player = _playerTestHelper.CreatePlayer(isActive: true, brandId: brand.Id);

            //create a VIP Level
            var vipLevel = _brandTestHelper.CreateVipLevel(brand.Id, isDefault: false);

            // login as the user and assign VIP level to the player
            _dashboardPage = _driver.LoginToAdminWebsiteAs(user.Username, password);
            _dashboardPage.BrandFilter.SelectAll();

            var playerManagerPage = _dashboardPage.Menu.ClickPlayerManagerMenuItem();
            var playerInfo        = playerManagerPage.OpenPlayerInfoPage(player.Username);

            playerInfo.OpenAccountInformationSection();
            var changeVipLevelDialog = playerInfo.OpenChangeVipLevelDialog();

            changeVipLevelDialog.Submit(vipLevel.Name);

            Assert.AreEqual(vipLevel.Name, playerInfo.VipLevel);
        }
Ejemplo n.º 21
0
        public void Can_assign_brand_currency()
        {
            var brand = BrandTestHelper.CreateBrand();

            BrandCommands.AssignBrandCurrency(new AssignBrandCurrencyRequest
            {
                Brand           = brand.Id,
                Currencies      = new[] { Currency.Code },
                BaseCurrency    = Currency.Code,
                DefaultCurrency = Currency.Code
            });

            brand = BrandQueries.GetBrand(brand.Id);

            Assert.That(brand.BrandCurrencies.Count, Is.EqualTo(1));

            var assignedCurrency = brand.BrandCurrencies.First().Currency;

            Assert.That(assignedCurrency.Code, Is.EqualTo(Currency.Code));
            Assert.That(assignedCurrency.Name, Is.EqualTo(Currency.Name));
        }
Ejemplo n.º 22
0
        public override void BeforeEach()
        {
            base.BeforeEach();

            SecurityRepository = Container.Resolve <ISecurityRepository>();
            BrandRepository    = Container.Resolve <IBrandRepository>();

            SecurityTestHelper = Container.Resolve <SecurityTestHelper>();
            SecurityTestHelper.PopulatePermissions();
            SecurityTestHelper.CreateAndSignInSuperAdmin();

            BrandQueries = Container.Resolve <BrandQueries>();

            BrandHelper = Container.Resolve <BrandTestHelper>();
            Brand       = BrandHelper.CreateBrand();
            SecurityTestHelper.CreateBrand(Brand.Id, Brand.LicenseeId, Brand.TimezoneId);
            Licensee = Brand.Licensee;

            AdminCommands = Container.Resolve <IAdminCommands>();
            AdminQueries  = Container.Resolve <IAdminQueries>();
        }
Ejemplo n.º 23
0
        public void Can_process_brand_registered()
        {
            // Act
            var brand = BrandTestHelper.CreateBrand();

            // Assert
            Assert.AreEqual(2, _reportRepository.BrandRecords.Count());
            var record = _reportRepository.BrandRecords.Last();

            Assert.AreEqual(brand.Id, record.BrandId);
            Assert.AreEqual(brand.Licensee.Name, record.Licensee);
            Assert.AreEqual(brand.Code, record.BrandCode);
            Assert.AreEqual(brand.Name, record.Brand);
            Assert.AreEqual(brand.Type.ToString(), record.BrandType);
            Assert.AreEqual(brand.PlayerPrefix, record.PlayerPrefix);
            Assert.AreEqual(brand.InternalAccountsNumber, record.AllowedInternalAccountsNumber);
            Assert.AreEqual(brand.Status.ToString(), record.BrandStatus);
            Assert.AreEqual(TimeZoneInfo.GetSystemTimeZones().Single(z => z.Id == brand.TimezoneId).DisplayName,
                            record.BrandTimeZone);
            record.Created.Should().BeCloseTo(brand.DateCreated, 50);
            Assert.AreEqual(brand.CreatedBy, record.CreatedBy);
        }
        public override void BeforeEach()
        {
            base.BeforeEach();

            _wagerConfigurationCommands = Container.Resolve <IWagerConfigurationCommands>();
            _wagerConfigurationQueries  = Container.Resolve <IWagerConfigurationQueries>();
            _brandRepository            = Container.Resolve <FakeBrandRepository>();
            _brandTestHelper            = Container.Resolve <BrandTestHelper>();

            var securityTestHelper = Container.Resolve <SecurityTestHelper>();

            securityTestHelper.PopulatePermissions();
            securityTestHelper.CreateAndSignInSuperAdmin();

            foreach (var currencyCode in TestDataGenerator.CurrencyCodes)
            {
                _brandRepository.Currencies.Add(new Currency {
                    Code = currencyCode
                });
            }

            _brand = _brandTestHelper.CreateBrand(isActive: true);
        }