Esempio n. 1
0
        public override void BeforeEach()
        {
            base.BeforeEach();

            Container.Resolve <PaymentWorker>().Start();
            _paymentTestHelper = Container.Resolve <PaymentTestHelper>();

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

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

            var brandTestHelper = Container.Resolve <BrandTestHelper>();
            var licensee        = brandTestHelper.CreateLicensee();
            var brand           = brandTestHelper.CreateBrand(licensee, isActive: true);

            _paymentRepository = Container.Resolve <IPaymentRepository>();
            _paymentRepository.Countries.Add(new Country {
                Code = "UA", Name = "Ukraine"
            });

            var playerTestHelper = Container.Resolve <PlayerTestHelper>();
            var player           = playerTestHelper.CreatePlayer(brandId: brand.Id);

            _player = _paymentRepository.Players.Single(x => x.Id == player.Id);

            var paymentLevel = _paymentTestHelper.CreatePaymentLevel(brand.Id, "CAD");

            _paymentTestHelper.CreatePlayerPaymentLevel(_player.Id, paymentLevel);

            var busMock = new Mock <IEventBus>();
            var offlineDepositValidator = new Mock <IPaymentSettingsValidator>();
            var actorInfoProvider       = Container.Resolve <IActorInfoProvider>();
            var playerIdentityValidator = new Mock <IPlayerIdentityValidator>();

            playerIdentityValidator.Setup(o => o.Validate(It.IsAny <Guid>(), It.IsAny <Core.Common.Data.Player.TransactionType>()));
            var docService = new Mock <IDocumentService>().Object;

            _commandsHandler = new OfflineDepositCommands(
                _paymentRepository,
                Container.Resolve <IPaymentQueries>(),
                busMock.Object,
                offlineDepositValidator.Object,
                actorInfoProvider,
                playerIdentityValidator.Object,
                docService,
                Container.Resolve <IOfflineDepositQueries>(),
                Container.Resolve <IServiceBus>(),
                Container.Resolve <IBonusApiProxy>(),
                Container.Resolve <IMessageTemplateService>());

            _bankAccount = _paymentTestHelper.CreateBankAccount(brand.Id, player.CurrencyCode);

            offlineDepositValidator
            .Setup(o => o.Validate(It.IsAny <Guid>(), It.IsAny <string>(), It.IsAny <decimal>()))
            .Callback((Guid param1, string param2, decimal param3) => { });
        }
Esempio n. 2
0
        public void Can_change_players_payment_level()
        {
            //create 2 players for the brand
            var player1 = _playerTestHelper.CreatePlayer(true, _brand.Id);
            var player2 = _playerTestHelper.CreatePlayer(true, _brand.Id);

            //create payment level for a brand
            var paymentLevelsPage = _dashboardPage.Menu.ClickPaymentLevelsMenuItem();

            var newPaymentLevelForm = paymentLevelsPage.OpenNewPaymentLevelForm();

            var bankAccount = _paymentTestHelper.CreateBankAccount(_brand.Id, DefaultCurrency);

            var paymentLevelCode          = TestDataGenerator.GetRandomString();
            var paymentLevelName          = paymentLevelCode + "Name";
            var submittedPaymentLevelForm = newPaymentLevelForm.Submit(_brand.Name, paymentLevelCode, paymentLevelName, bankAccount.AccountId, false);

            submittedPaymentLevelForm.CloseTab("View Payment Level");

            //open admin page
            var paymentLevelSettingsPage = _dashboardPage.Menu.ClickPaymentLevelSettingsMenuItem();

            //filte by brand , should list 2 players after filter
            paymentLevelSettingsPage.FilterGrid(_brand.Name);

            //select players
            paymentLevelSettingsPage.SelectPlayer(player1.Username);
            paymentLevelSettingsPage.SelectPlayer(player2.Username);

            //click [set Payment Level] button
            var setPaymentLevelPage = paymentLevelSettingsPage.OpenSetPaymentLevelPage();

            //input data and submit
            setPaymentLevelPage.Submit(paymentLevelName, "change players:" + player1.Username + "," + player2.Username + ", payment level");

            //confirmed message
            Assert.AreEqual("The payment level has been assigned", setPaymentLevelPage.ConfirmationMessage);

            //check player 1's payment level in player manager
            var player1PaymentLevel = GetPlayerPaymentLevel(player1.Username);

            Assert.AreEqual(paymentLevelName, player1PaymentLevel);

            //check player 2's payment level in player manager
            var player2PaymentLevel = GetPlayerPaymentLevel(player2.Username);

            Assert.AreEqual(paymentLevelName, player2PaymentLevel);
        }
Esempio n. 3
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();
        }