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 Can_delete_admin_ip_regulation()
        {
            /*** Arrange ***/
            var ipAddress = TestDataGenerator.GetRandomIpAddress();

            var adminIpRegulation = new AddBackendIpRegulationData
            {
                IpAddress = ipAddress
            };

            _backendService.CreateIpRegulation(adminIpRegulation);

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

            /*** Act ***/
            _backendService.DeleteIpRegulation(regulation.Id);

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

            Assert.IsNull(deletedRegulation);
        }