public void Can_delete_brand_ip_regulation()
        {
            /*** Arrange ***/
            var ipAddress = TestDataGenerator.GetRandomIpAddress();

            const string redirectionUrl = "google.com";

            var brandIpRegulation = new AddBrandIpRegulationData
            {
                IpAddress = ipAddress,
                BrandId   = Brand.Id,
                // Ip address is blocked with redirection to specified Url
                BlockingType   = IpRegulationConstants.BlockingTypes.Redirection,
                RedirectionUrl = redirectionUrl
            };

            _brandService.CreateIpRegulation(brandIpRegulation);

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

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

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

            Assert.IsNull(deletedRegulation);
        }
Beispiel #2
0
        public void Cannot_execute_BackendIpRegulationService_without_permissions()
        {
            /* Arrange */
            LogWithNewAdmin(Modules.PlayerManager, Permissions.View);

            /* Act */
            Assert.Throws <InsufficientPermissionsException>(() => _brandService.GetIpRegulations());
            Assert.Throws <InsufficientPermissionsException>(() => _brandService.CreateIpRegulation(new AddBrandIpRegulationData()));
            Assert.Throws <InsufficientPermissionsException>(() => _brandService.UpdateIpRegulation(new EditBrandIpRegulationData()));
            Assert.Throws <InsufficientPermissionsException>(() => _brandService.DeleteIpRegulation(new Guid()));
        }