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); } }
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); } }