Пример #1
0
        public void GetPolicyAsync_2()
        {
            var opt = new AuthorizationOptions();

            opt.AddPolicy("test", p => p.Requirements.Add(new NameAuthorizationRequirement("test")));
            var provider = new AuthorizationPolicyProvider(new OptionsWrapper <AuthorizationOptions>(opt));

            Should.NotThrow(() => provider.GetPolicyAsync("test")).Requirements.ShouldHaveSingleItem().ShouldBeOfType <NameAuthorizationRequirement>();
        }
Пример #2
0
        public void GetPolicyAsync()
        {
            var provider = new AuthorizationPolicyProvider(new OptionsWrapper <AuthorizationOptions>(new AuthorizationOptions()));

            Should.NotThrow(() => provider.GetPolicyAsync("test")).Requirements.ShouldHaveSingleItem().ShouldBeOfType <PermissionRequirement>();
        }