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"));
        }
예제 #2
0
        public IHttpActionResult Edit(EditPlayerData data)
        {
            VerifyPermission(Permissions.Update, Modules.PlayerManager);

            if (ModelState.IsValid == false)
            {
                return(Ok(ErrorResponse()));
            }

            var validationResult = _commands.ValidateThatPlayerInfoCanBeEdited(data);

            if (!validationResult.IsValid)
            {
                return(Ok(ValidationExceptionResponse(validationResult.Errors)));
            }

            _commands.Edit(data);
            return(Ok(new { Result = "success" }));
        }
예제 #3
0
        public void Can_process_update_player()
        {
            // Arrange
            const string newAddress     = "#305-1250 Homer Street";
            const string newPhoneNumber = "16046287716";
            const string birthday       = "1980/01/01";

            var player       = PlayerTestHelper.CreatePlayer();
            var paymentLevel = Container.Resolve <PaymentTestHelper>().CreatePaymentLevel(CurrentBrand.Id, player.CurrencyCode);

            // Act
            _playerCommands.Edit(new EditPlayerData
            {
                PlayerId                    = player.Id,
                FirstName                   = player.FirstName,
                LastName                    = player.LastName,
                MailingAddressCity          = player.MailingAddressCity,
                MailingAddressPostalCode    = player.MailingAddressPostalCode,
                MailingAddressStateProvince = player.MailingAddressStateProvince,
                CountryCode                 = player.CountryCode,
                Email               = player.Email,
                DateOfBirth         = birthday,
                MailingAddressLine1 = newAddress,
                PhoneNumber         = newPhoneNumber,
                PaymentLevelId      = paymentLevel.Id,
                Title               = (PlayerEnums.Title?)player.Title,
                Gender              = (PlayerEnums.Gender?)player.Gender,
                AccountAlertEmail   = true,
                MarketingAlertEmail = true
            });

            // Assert
            Assert.AreEqual(1, _reportRepository.PlayerRecords.Count());
            var record = _reportRepository.PlayerRecords.Single();

            Assert.AreEqual(player.Email, record.Email);
            Assert.AreEqual(newAddress, record.StreetAddress);
            Assert.AreEqual(newPhoneNumber, record.Mobile);
            var expectedDateString = DateTimeOffset.Parse(birthday + " +0:00").ToString("yyyy'/'MM'/'dd");
            var actualDateString   = record.Birthday.ToString("yyyy'/'MM'/'dd");

            Assert.AreEqual(expectedDateString, actualDateString);
        }