コード例 #1
0
        public async Task ReturnsSkipIfNoDecisionIsMade()
        {
            using (var rules = new TestRules <Album>(new Album()))
            {
                var subject = new ShortCircuitPolicy <Album>(
                    rules.SkipRule());
                var copy   = subject.BuildCopy(rules.SourceContext, rules.SourceNode);
                var result = await copy.AuthorizeAsync();

                Assert.IsType <Skip>(result);
            }
        }
コード例 #2
0
        public async Task ReturnsAllowIfFirstDecisionIsAllow()
        {
            using (var rules = new TestRules <Album>(new Album()))
            {
                var subject = new ShortCircuitPolicy <Album>(
                    rules.SkipRule(),
                    rules.AllowRule(),
                    rules.DenyRule());
                var copy   = subject.BuildCopy(rules.SourceContext, rules.SourceNode);
                var result = await copy.AuthorizeAsync();

                Assert.IsType <Allow <Album> >(result);
            }
        }