Esempio n. 1
0
        public void CreateCountry(string code, string name)
        {
            using (var scope = CustomTransactionScope.GetTransactionScope())
            {
                var country = new Country
                {
                    Code = code,
                    Name = name
                };
                _repository.Countries.Add(country);
                _repository.SaveChanges();

                _eventBus.Publish(new CountryCreated(country));

                scope.Complete();
            }
        }
Esempio n. 2
0
        public Brand CreateBrand(
            Licensee licensee = null,
            Country country   = null,
            Culture culture   = null,
            Currency currency = null,
            bool isActive     = false)
        {
            licensee = licensee ?? _brandRepository.Licensees.FirstOrDefault() ?? CreateLicensee();

            var products = licensee.Products;

            country  = country ?? licensee.Countries.First();
            culture  = culture ?? licensee.Cultures.First();
            currency = currency ?? licensee.Currencies.First();

            var brandId = CreateBrand(licensee, PlayerActivationMethod.Automatic);

            CreateWallet(licensee.Id, brandId, products.Select(x => x.ProductId).ToArray());
            AssignCountry(brandId, country.Code);
            AssignCurrency(brandId, currency.Code);
            _brandRepository.SaveChanges();
            AssignCulture(brandId, culture.Code);
            AssignProducts(brandId, products.Select(x => x.ProductId).ToArray());
            CreateRiskLevel(brandId);
            AssignBrandCredentials(brandId);

            _paymentTestHelper.CreateBank(brandId, country.Code);
            _paymentTestHelper.CreateBankAccount(brandId, currency.Code);
            _paymentTestHelper.CreatePaymentGatewaySettings(brandId);
            _paymentTestHelper.CreatePaymentLevel(brandId, currency.Code);

            CreateVipLevel(brandId);

            if (isActive)
            {
                _brandCommands.ActivateBrand(new ActivateBrandRequest
                {
                    BrandId = brandId,
                    Remarks = TestDataGenerator.GetRandomString()
                });
            }

            return(_brandQueries.GetBrandOrNull(brandId));
        }