Ejemplo 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) => { });
        }