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())); }
public void Can_create_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 }; /*** Act ***/ _brandService.CreateIpRegulation(brandIpRegulation); /*** Assert ***/ var regulation = _brandService.GetIpRegulations().SingleOrDefault(ip => ip.IpAddress == ipAddress); Assert.IsNotNull(regulation); }