public void Cannot_execute_PlayerCommands_without_permissions() { // Arrange LogWithNewAdmin(Modules.PlayerManager, Permissions.View); // Act Assert.Throws <InsufficientPermissionsException>(() => _playerCommands.Edit(new EditPlayerData())); Assert.Throws <InsufficientPermissionsException>(() => _playerCommands.ChangePlayerVipLevel(new Guid(), new Guid())); Assert.Throws <InsufficientPermissionsException>(() => _playerCommands.AssignVip(new Core.Common.Data.Player.Player(), new VipLevel())); Assert.Throws <InsufficientPermissionsException>(() => _playerCommands.SetStatus(new Guid(), true)); Assert.Throws <InsufficientPermissionsException>(() => _playerCommands.Register(new RegistrationData())); Assert.Throws <InsufficientPermissionsException>(() => _playerCommands.ChangeVipLevel(new Guid(), new Guid(), "Some remark")); }
public Player CreatePlayer(bool isActive = true, Guid?brandId = null) { var playerRegData = TestDataGenerator.CreateRandomRegistrationRequestData(); var registrationData = Mapper.DynamicMap <RegistrationData>(playerRegData); brandId = brandId ?? _brandRepository.Brands.First().Id; var brand = _brandQueries.GetBrandOrNull(brandId.Value); registrationData.BrandId = brand.Id.ToString(); registrationData.CountryCode = brand.BrandCountries.First().Country.Code; registrationData.CurrencyCode = brand.BrandCurrencies.First().CurrencyCode; registrationData.CultureCode = brand.BrandCultures.First().CultureCode; registrationData.IsInactive = !isActive; registrationData.AccountAlertEmail = true; registrationData.AccountAlertSms = true; var playerId = _playerCommands.Register(registrationData); return(_playerQueries.GetPlayer(playerId)); }
private void AddPlayer(Guid brandId, string firstName, string lastName, string username, Guid securityQuestionId, string password = "******", string currency = "CAD", string culture = "en-US", decimal initialDeposit = 0m, string referralId = null, bool isActive = true, bool isLocked = false, string state = "State/Province") { if (_playerRepository.Players.Any(x => x.Username == username)) { return; } var playerData = new RegistrationData { BrandId = brandId.ToString(), CurrencyCode = currency, CultureCode = culture, Username = username, Password = password, PasswordConfirm = password, IdStatus = IdStatus.Verified.ToString(), IsLocked = isLocked, Comments = "Created by ApplicationSeeder", Gender = "Male", Title = "Mr", FirstName = firstName, LastName = lastName, Email = CreateEmailAddress(), AccountAlertSms = true, AccountAlertEmail = true, PhoneNumber = "123456789", MailingAddressLine1 = "305-1250 Homer Street", MailingAddressCity = "Vancouver", MailingAddressPostalCode = "V6B1C6", MailingAddressStateProvince = state, PhysicalAddressLine1 = "305-1250 Homer Street", PhysicalAddressCity = "Vancouver", PhysicalAddressPostalCode = "V6B1C6", CountryCode = "US", DateOfBirth = "1990/01/01", ContactPreference = "Email", SecurityAnswer = "1", SecurityQuestionId = securityQuestionId.ToString(), ReferralId = referralId, IpAddress = "127.0.0.1" }; var playerId = _playerCommands.Register(playerData); _playerCommands.SetStatus(playerId, isActive); if (initialDeposit > 0m) { MakeDeposit(username, initialDeposit); } }
public PlayerData CreatePlayer(bool isActive = true) { var isMale = new Random().Next(2) == 1; var brand = _brandRepository.Brands.First(); var password = TestDataGenerator.GetRandomString(12); var playerId = _playerCommands.Register(new RegistrationData { FirstName = TestDataGenerator.GetRandomString(), LastName = TestDataGenerator.GetRandomString(10), Email = TestDataGenerator.GetRandomEmail(), PhoneNumber = TestDataGenerator.GetRandomString(12, TestDataGenerator.NumericChars), MailingAddressLine1 = "Address Line 1", MailingAddressLine2 = "Address Line 2", MailingAddressLine3 = "Address Line 3", MailingAddressLine4 = "Address Line 4", MailingAddressCity = "Test City", MailingAddressPostalCode = TestDataGenerator.GetRandomString(5, TestDataGenerator.NumericChars), PhysicalAddressLine1 = "Physical Address Line 1", PhysicalAddressLine2 = "Physical Address Line 2", PhysicalAddressLine3 = "Physical Address Line 3", PhysicalAddressLine4 = "Physical Address Line 4", PhysicalAddressCity = "Physical Test City", PhysicalAddressPostalCode = TestDataGenerator.GetRandomString(5, TestDataGenerator.NumericChars), CountryCode = brand.Countries.First().Code, CurrencyCode = brand.DefaultCurrency, CultureCode = brand.DefaultCulture.Code, Username = TestDataGenerator.GetRandomString(12), Password = password, PasswordConfirm = password, DateOfBirth = TestDataGenerator.GetDateOfBirthOver18().ToString("yyyy-MM-dd"), BrandId = brand.Id.ToString(), Gender = isMale ? Gender.Male.ToString() : Gender.Female.ToString(), Title = isMale ? Title.Mr.ToString() : Title.Mrs.ToString(), ContactPreference = ContactMethod.Phone.ToString(), SecurityQuestionId = TestDataGenerator.GetRandomSecurityQuestion(), SecurityAnswer = "Security Answer " + TestDataGenerator.GetRandomString(), AccountStatus = isActive ? AccountStatus.Active.ToString() : AccountStatus.Inactive.ToString(), IdStatus = "Verified" }); return(_playerQueries.GetPlayer(playerId)); }
public IHttpActionResult Add(AddPlayerData command) { VerifyPermission(Permissions.Create, Modules.PlayerManager); var playerData = Mapper.DynamicMap <RegistrationData>(command); playerData.IsRegisteredFromAdminSite = true; playerData.IpAddress = "127.0.0.1"; var validationResult = _commands.ValidateThatPlayerCanBeRegistered(playerData); if (!validationResult.IsValid) { return(Ok(ValidationExceptionResponse(validationResult.Errors))); } _commands.Register(playerData); return(Ok(new { Result = "success" })); }