public void Cannot_execute_BackendIpRegulationService_without_permissions()
        {
            /* Arrange */
            LogWithNewAdmin(Modules.PlayerManager, Permissions.View);

            /* Act */
            Assert.Throws <InsufficientPermissionsException>(() => _backendService.GetIpRegulations());
            Assert.Throws <InsufficientPermissionsException>(() => _backendService.CreateIpRegulation(new AddBackendIpRegulationData()));
            Assert.Throws <InsufficientPermissionsException>(() => _backendService.UpdateIpRegulation(new EditBackendIpRegulationData()));
            Assert.Throws <InsufficientPermissionsException>(() => _backendService.DeleteIpRegulation(new Guid()));
        }
Ejemplo n.º 2
0
        public void WhenNewAdminIpRegulationIsCreated()
        {
            var ipAddress = TestDataGenerator.GetRandomIpAddress();

            var data = new AddBackendIpRegulationData
            {
                IpAddress = ipAddress
            };

            var adminIpRegulation = BackendIpRegulationService.CreateIpRegulation(data);

            ScenarioContext.Current.Add("adminIpRegulationId", adminIpRegulation.Id);
        }
Ejemplo n.º 3
0
        private void AddAdminIpRegulations(string ipAddress)
        {
            var regulation = _securityRepository.AdminIpRegulations.FirstOrDefault(x => x.IpAddress == ipAddress);

            if (regulation != null)
            {
                return;
            }

            _backendIpRegulationService.CreateIpRegulation(new AddBackendIpRegulationData()
            {
                IpAddress   = ipAddress,
                Description = "test",
            });
        }
Ejemplo n.º 4
0
        public void Can_create_admin_ip_regulation()
        {
            /*** Arrange ***/
            var ipAddress = TestDataGenerator.GetRandomIpAddress();

            var adminIpRegulation = new AddBackendIpRegulationData
            {
                IpAddress = ipAddress
            };

            /*** Act ***/
            _backendService.CreateIpRegulation(adminIpRegulation);

            /*** Assert ***/
            var regulation = _backendService.GetIpRegulations().SingleOrDefault(ip => ip.IpAddress == ipAddress);

            Assert.IsNotNull(regulation);
        }