public void OptionsAreConfiguredCorrectly()
        {
            var ourOptions = new AuthZyinAuthorizationOptions();

            ourOptions.DefaultPolicy              = rolePolicy;
            ourOptions.FallbackPolicy             = ourOptions.DefaultPolicy;
            ourOptions.InvokeHandlersAfterFailure = false;
            testPolicies.ToList().ForEach(kvp => ourOptions.AddPolicy(kvp.Key, kvp.Value));
            testPolicyBuilders.ToList().ForEach(kvp => ourOptions.AddPolicy(kvp.Key, kvp.Value));

            // Compare with base
            Assert.True(this.AreOptionsEqual(ourOptions, ourOptions as AuthorizationOptions));

            // Compare to a new AuthorizationOptions object using the "captured" actions
            var newOptions = new AuthorizationOptions();

            ourOptions.CapturedConfigureAction(newOptions);
            Assert.True(this.AreOptionsEqual(ourOptions, newOptions));
        }
        public void AddPolicyThrowsOnInvalidArg()
        {
            var options = new AuthZyinAuthorizationOptions();

            Assert.Throws <ArgumentNullException>(() => options.AddPolicy(null, (AuthorizationPolicy)null));
            Assert.Throws <ArgumentNullException>(() => options.AddPolicy(null, (Action <AuthorizationPolicyBuilder>)null));
            Assert.Throws <ArgumentNullException>(() => options.AddPolicy(nameof(rolePolicy), (AuthorizationPolicy)null));
            Assert.Throws <ArgumentNullException>(() => options.AddPolicy(nameof(claimPolicyConfigure), (Action <AuthorizationPolicyBuilder>)null));

            // Throws on duplicate policies
            options.AddPolicy(nameof(rolePolicy), rolePolicy);
            Assert.Throws <ArgumentException>(() => options.AddPolicy(nameof(rolePolicy), rolePolicy));
        }