コード例 #1
0
        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();
        }
コード例 #2
0
        public void Can_edit_payment_level()
        {
            //create a payment level for the brand
            var paymentLevel        = _paymentTestHelper.CreatePaymentLevel(_brand.Id, _brandCurrency);
            var newPaymentLevelName = paymentLevel.Name + "1";
            var editForm            = _paymentLevelsPage.OpenEditForm(paymentLevel.Name);
            var submittedEditForm   = editForm.Submit(newPaymentLevelName);

            Assert.AreEqual("The payment level has been updated.", submittedEditForm.ConfirmationMessage);
            Assert.AreEqual(newPaymentLevelName, submittedEditForm.PaymentLevelName);
        }
コード例 #3
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) => { });
        }