示例#1
0
        public bool IsBasicAuthEnabled(bool enabled)
        {
            var sut = new BasicAuthService(Mock.Of <IOptionsMonitor <BasicAuthSettings> >(_ => _.CurrentValue == new BasicAuthSettings()
            {
                Enabled = enabled
            }), new IpAddressUtilities());

            return(sut.IsBasicAuthEnabled());
        }
示例#2
0
        public bool IsIpAllowListed(string clientIpAddress, string commaSeperatedAllowlist)
        {
            var allowedIPs = commaSeperatedAllowlist.Split(",").Select(x => x.Trim()).ToArray();
            var sut        = new BasicAuthService(Mock.Of <IOptionsMonitor <BasicAuthSettings> >(_ => _.CurrentValue == new BasicAuthSettings()
            {
                AllowedIPs = allowedIPs
            }), new IpAddressUtilities());

            return(sut.IsIpAllowListed(IPAddress.Parse(clientIpAddress)));
        }
 public void BeforeTest()
 {
     service = new BasicAuthService(BrowserType.ChromeIncognito.ToString());
 }