예제 #1
0
        public void Can_process_VipLevel_registered()
        {
            // Arrange
            var oldVipLevelRecordCount = _reportRepository.VipLevelRecords.Count();

            // Act
            var vipLevel = BrandTestHelper.CreateVipLevel(CurrentBrand.Id, isDefault: false);

            // Assert
            Assert.AreEqual(oldVipLevelRecordCount + 1, _reportRepository.VipLevelRecords.Count());
            var record = _reportRepository.VipLevelRecords.Last();

            Assert.AreEqual(vipLevel.Id, record.VipLevelId);
            Assert.AreEqual(null, record.VipLevelLimitId);
            Assert.AreEqual(vipLevel.Brand.Licensee.Name, record.Licensee);
            Assert.AreEqual(vipLevel.Brand.Name, record.Brand);
            Assert.AreEqual(vipLevel.Code, record.Code);
            Assert.AreEqual(vipLevel.Rank, record.Rank);
            Assert.AreNotEqual(vipLevel.Id, CurrentBrand.DefaultVipLevelId);
            Assert.AreEqual(vipLevel.Status.ToString(), record.Status);
            Assert.AreEqual(null, record.GameProvider);
            Assert.AreEqual(null, record.Currency);
            Assert.AreEqual(null, record.BetLevel);
            record.Created.Should().BeCloseTo(vipLevel.DateCreated);
            Assert.AreEqual(vipLevel.CreatedBy, record.CreatedBy);
        }
예제 #2
0
        public void ThenNewBrandIsSuccessfullyAdded()
        {
            var licensee = BrandTestHelper.CreateLicensee();

            var data = new AddBrandRequest()
            {
                Code                   = TestDataGenerator.GetRandomString(),
                InternalAccounts       = 1,
                EnablePlayerPrefix     = true,
                PlayerPrefix           = TestDataGenerator.GetRandomString(3),
                Licensee               = licensee.Id,
                Name                   = TestDataGenerator.GetRandomString(),
                PlayerActivationMethod = PlayerActivationMethod.Automatic,
                TimeZoneId             = TestDataGenerator.GetRandomTimeZone().Id,
                Type                   = BrandType.Integrated,
                Email                  = TestDataGenerator.GetRandomEmail(),
                SmsNumber              = TestDataGenerator.GetRandomPhoneNumber(useDashes: false),
                WebsiteUrl             = TestDataGenerator.GetRandomWebsiteUrl()
            };

            var result = AdminApiProxy.AddBrand(data);

            result.Should().NotBeNull();
            result.Success.Should().BeTrue();
            result.Data.Should().NotBeNull();
        }
예제 #3
0
        public void Can_process_VipLevel_registered_with_vip_level_limits()
        {
            // Arrange
            const int vipLevelLimitCount     = 3;
            var       oldVipLevelRecordCount = _reportRepository.VipLevelRecords.Count();

            // Act
            var vipLevel = BrandTestHelper.CreateVipLevel(CurrentBrand.Id, vipLevelLimitCount, false);

            // Assert
            Assert.AreEqual(oldVipLevelRecordCount + vipLevelLimitCount, _reportRepository.VipLevelRecords.Count());
            var records = _reportRepository.VipLevelRecords.Skip(oldVipLevelRecordCount);
            var i       = 0;

            foreach (var record in records)
            {
                Assert.AreEqual(vipLevel.Id, record.VipLevelId);
                Assert.AreEqual(vipLevel.Brand.Licensee.Name, record.Licensee);
                Assert.AreEqual(vipLevel.Brand.Name, record.Brand);
                Assert.AreEqual(vipLevel.Code, record.Code);
                Assert.AreEqual(vipLevel.Rank, record.Rank);
                Assert.AreNotEqual(vipLevel.Id, CurrentBrand.DefaultVipLevelId);
                Assert.AreEqual(vipLevel.Status.ToString(), record.Status);
                record.Created.Should().BeCloseTo(vipLevel.DateCreated, 500);
                Assert.AreEqual(vipLevel.CreatedBy, record.CreatedBy);

                var vipLevelLimit = vipLevel.VipLevelGameProviderBetLimits.ElementAt(i);
                Assert.AreEqual(vipLevelLimit.Id, record.VipLevelLimitId);
                Assert.AreEqual(GameProvider(vipLevelLimit.GameProviderId), record.GameProvider);
                Assert.AreEqual(vipLevelLimit.Currency.Code, record.Currency);
                Assert.AreEqual(BetLimit(vipLevelLimit.BetLimitId), record.BetLevel);
                i++;
            }
        }
예제 #4
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));
        }
예제 #5
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);
        }
예제 #6
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));
        }
예제 #7
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);
        }
예제 #8
0
 public override void BeforeAll()
 {
     base.BeforeAll();
     _playerTestHelper   = _container.Resolve <PlayerTestHelper>();
     _securityTestHelper = _container.Resolve <SecurityTestHelper>();
     _brandTestHelper    = _container.Resolve <BrandTestHelper>();
     _defaultLicensee    = _brandTestHelper.GetDefaultLicensee();
     _playerQueries      = _container.Resolve <PlayerQueries>();
 }
예제 #9
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);
        }
예제 #10
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);
        }
예제 #11
0
        public override void BeforeEach()
        {
            base.BeforeEach();

            _gameRepository    = Container.Resolve <IGameRepository>();
            _productOperations = Container.Resolve <ProductOperations>();

            PlayerTestHelper = Container.Resolve <PlayerTestHelper>();
            GamesTestHelper  = Container.Resolve <GamesTestHelper>();
            BrandTestHelper  = Container.Resolve <BrandTestHelper>();
        }
예제 #12
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));
        }
예제 #13
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);
        }
예제 #14
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);
        }
예제 #15
0
        public override void BeforeEach()
        {
            base.BeforeEach();

            PaymentTestHelper  = Container.Resolve <PaymentTestHelper>();
            BrandTestHelper    = Container.Resolve <BrandTestHelper>();
            SecurityTestHelper = Container.Resolve <SecurityTestHelper>();
            StartWorkers();
            SecurityTestHelper.PopulatePermissions();
            SecurityTestHelper.CreateAndSignInSuperAdmin();
            SecurityTestHelper.SignInClaimsSuperAdmin();
            CurrentBrand = BrandTestHelper.CreateActiveBrandWithProducts();
        }
        public override void BeforeEach()
        {
            base.BeforeEach();
            _playerRepository   = Container.Resolve <IPlayerRepository>();
            _paymentRepository  = Container.Resolve <IPaymentRepository>();
            _securityTestHelper = Container.Resolve <SecurityTestHelper>();
            _securityTestHelper.PopulatePermissions();
            _securityTestHelper.CreateAndSignInSuperAdmin();

            _paymentTestHelper = Container.Resolve <PaymentTestHelper>();
            _brandTestHelper   = Container.Resolve <BrandTestHelper>();
            _playerTestHelper  = Container.Resolve <PlayerTestHelper>();
            _playerCommands    = Container.Resolve <PlayerCommands>();
        }
예제 #17
0
        public void Can_process_Language_created()
        {
            // Act
            var language = BrandTestHelper.CreateCulture("en-TS", "English (Test)");

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

            Assert.AreEqual(language.Code, record.Code);
            Assert.AreEqual(language.Name, record.Name);
            Assert.AreEqual(language.NativeName, record.NativeName);
            record.Created.Should().BeCloseTo(language.DateCreated, 50);
            Assert.AreEqual(language.CreatedBy, record.CreatedBy);
        }
예제 #18
0
        public override void BeforeAll()
        {
            base.BeforeAll();

            _paymentTestHelper = _container.Resolve <PaymentTestHelper>();
            _playerCommands    = _container.Resolve <PlayerCommands>();
            _brandTestHelper   = _container.Resolve <BrandTestHelper>();
            _playerTestHelper  = _container.Resolve <PlayerTestHelper>();
            _autoVerificationConfigurationTestHelper = _container.Resolve <AutoVerificationConfigurationTestHelper>();
            _riskProfileCheckTestHelper = _container.Resolve <RiskProfileCheckTestHelper>();

            //create a not default VIP Level for Brand
            _vipLevel = _brandTestHelper.CreateNotDefaultVipLevel(DefaultBrandId);

            //create a player for the DefaultBrandId
            var player   = _playerTestHelper.CreatePlayer(isActive: true, brandId: DefaultBrandId);
            var playerId = player.Id;

            _player         = _container.Resolve <PlayerQueries>().GetPlayer(playerId);
            _playerUsername = _player.Username;

            _paymentTestHelper.CreatePlayerBankAccount(playerId, DefaultBrandId, true);

            //change the VIP Level for Player
            _playerCommands.ChangeVipLevel(playerId, _vipLevel.Id, "changed vip level");

            //deposit
            _paymentTestHelper.MakeDeposit(_playerUsername, 100);
            _paymentTestHelper.MakeDeposit(_playerUsername, 200);
            _paymentTestHelper.MakeDeposit(_playerUsername, 300);

            //create Auto Verification configuration which expected to be failed
            _avcConfigurationBuilder = new AvcConfigurationBuilder(DefaultBrandId, new [] { _vipLevel.Id }, "CAD");
            _avcConfigurationBuilder.SetupTotalDepositAmount(1500, ComparisonEnum.GreaterOrEqual);
            _avcDTO = _avcConfigurationBuilder.Configuration;

            _avc = _autoVerificationConfigurationTestHelper.CreateConfiguration(_avcDTO);
            _autoVerificationConfigurationTestHelper.Activate(_avc.Id);

            //create Risk Profile Check configuration
            _riskProfileCheckConfigurationBuilder = new RiskProfileCheckConfigurationBuilder(DefaultBrandId, _avcDTO.Licensee, "CAD", new List <Guid> {
                _vipLevel.Id
            });
            _rpcDTO = _riskProfileCheckConfigurationBuilder.Configuration;
            var createdConfigurationEntity = _riskProfileCheckTestHelper.CreateConfiguration(_rpcDTO);

            _rpcDTO.Id = createdConfigurationEntity.Id;
        }
예제 #19
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);
        }
예제 #20
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);
        }
예제 #21
0
        public void Can_process_licensee_deactivated()
        {
            // Arrange
            var licensee = BrandTestHelper.CreateLicensee();

            // Act
            _licenseeCommands.Deactivate(licensee.Id, "test");

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

            Assert.AreEqual(licensee.Id, record.LicenseeId);
            Assert.AreEqual(licensee.Status.ToString(), record.Status);
            record.Deactivated.Should().BeCloseTo(licensee.DateDeactivated.Value, 50);
            Assert.AreEqual(licensee.DeactivatedBy, record.DeactivatedBy);
        }
예제 #22
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();
        }
예제 #23
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));
        }
예제 #24
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);
        }
예제 #25
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();
        }
예제 #26
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);
        }
예제 #27
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));
        }
예제 #28
0
        public void Can_process_licensee_created()
        {
            // Act
            var licensee = BrandTestHelper.CreateLicensee(false);

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

            Assert.AreEqual(licensee.Id, record.LicenseeId);
            Assert.AreEqual(licensee.Name, record.Name);
            Assert.AreEqual(licensee.Email, record.EmailAddress);
            Assert.AreEqual(licensee.CompanyName, record.CompanyName);
            Assert.AreEqual(licensee.AffiliateSystem, record.AffiliateSystem);
            Assert.AreEqual(licensee.Status.ToString(), record.Status);
            Assert.AreEqual(licensee.ContractStart, record.ContractStart);
            Assert.AreEqual(licensee.ContractEnd, record.ContractEnd);
            Assert.AreEqual(Enum.GetName(typeof(LicenseeStatus), licensee.Status), record.Status);
            record.Created.Should().BeCloseTo(licensee.DateCreated, 50);
            Assert.AreEqual(licensee.CreatedBy, record.CreatedBy);
        }
예제 #29
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>();
        }
예제 #30
0
        public void Can_process_licensee_updated()
        {
            // Arrange
            var licensee           = BrandTestHelper.CreateLicensee(false);
            var newName            = TestDataGenerator.GetRandomString(5);
            var newCompanyName     = newName + " Inc.";
            var newEmail           = TestDataGenerator.GetRandomEmail();
            var newAffiliateSystem = TestDataGenerator.GetRandomNumber(2) > 1;
            var newContractStart   = DateTimeOffset.UtcNow.Date.AddDays(-TestDataGenerator.GetRandomNumber(30));
            var newContractEnd     = newContractStart.AddMonths(3);

            // Act
            var @event = new LicenseeUpdated(new Licensee
            {
                Id              = licensee.Id,
                Name            = newName,
                CompanyName     = newCompanyName,
                Email           = newEmail,
                AffiliateSystem = newAffiliateSystem,
                ContractStart   = newContractStart,
                ContractEnd     = newContractEnd
            });

            _serviceBus.PublishMessage(@event);

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

            Assert.AreEqual(licensee.Id, record.LicenseeId);
            Assert.AreEqual(newName, record.Name);
            Assert.AreEqual(newCompanyName, record.CompanyName);
            Assert.AreEqual(newEmail, record.EmailAddress);
            Assert.AreEqual(newAffiliateSystem, record.AffiliateSystem);
            Assert.AreEqual(newContractStart.Date, record.ContractStart.Date);
            Assert.AreEqual(newContractEnd.Date, record.ContractEnd.Value.Date);
            Assert.AreEqual(licensee.Status.ToString(), record.Status);
            record.Updated.Should().BeCloseTo(@event.EventCreated);
            Assert.AreEqual("SuperAdmin", record.UpdatedBy);
        }