コード例 #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>();
        }