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)); }
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(); }
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)); }
public void Can_not_change_payment_level_with_different_currencyCode() { //setup var currencies = new List <Core.Brand.Interface.Data.Currency> { _brandTestHelper.CreateCurrency("EUR", "EUR Dollar"), _brandTestHelper.CreateCurrency("CAD", "Canadian Dollar"), }; var license = _brandTestHelper.CreateLicensee(true, currencies: currencies); var brand = _brandTestHelper.CreateBrand(license); var player = _playerTestHelper.CreatePlayer();//Player's currency is EUR _brandTestHelper.AssignLicenseeCurrency(brand.LicenseeId, "CAD"); _brandTestHelper.AssignCurrency(brand.Id, "CAD"); var paymentLevel = _paymentTestHelper.CreatePaymentLevel(brand.Id, "CAD");//Payment Level's currency is CAD //act var reseponse = _playerCommands.ValidatePlayerPaymentLevelCanBeChanged(new ChangePaymentLevelData { PlayerId = player.Id, PaymentLevelId = paymentLevel.Id, Remarks = "test" }); //assert reseponse.IsValid.Should().BeFalse(); reseponse.Errors[0].ErrorMessage.Should().Be(PaymentLevelErrors.PaymentLevelAndPlayerNotMatch.ToString()); }
protected Admin CreateAdminWithPermissions(string category, string[] permissions) { var licensee = BrandTestHelper.CreateLicensee(); var brand = BrandTestHelper.CreateBrand(licensee, isActive: true); var brands = new[] { brand }; return(SecurityTestHelper.CreateAdmin(category, permissions, brands)); }
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); }
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); }
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); }
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); }
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); }
public void Can_export_report_data() { // Arrange BrandTestHelper.CreateLicensee(); var filteredRecords = ReportController.FilterAndOrder( _reportQueries.GetLicenseeRecordsForExport(), new LicenseeRecord(), "Created", "asc"); // Act var content = Encoding.Unicode.GetString(ReportController.ExportToExcel(filteredRecords)); // Assert Assert.AreNotEqual(content.IndexOf("<table"), -1); }
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); }
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); }
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); }