Esempio n. 1
0
        public void ReturnsPolicyWhenAttributeIsInherited()
        {
            var mi     = typeof(AttributePolicyProviderShould).GetMethod(nameof(UsesInheritedAttribute));
            var sut    = new TestAttributePolicyProvider();
            var policy = sut.GetSyncPolicy(GetTestContext(mi));

            policy.ShouldBeOfType <TestPolicy>();
        }
Esempio n. 2
0
        public void ReturnsNullWhenMethodHasNoPolicyAttribute()
        {
            var mi     = typeof(AttributePolicyProviderShould).GetMethod(nameof(NoAttribute));
            var sut    = new TestAttributePolicyProvider();
            var policy = sut.GetSyncPolicy(GetTestContext(mi));

            policy.ShouldBeNull();
        }
Esempio n. 3
0
        public void ReturnsWrappedPoliciesSortedByName()
        {
            var mi     = typeof(AttributePolicyProviderShould).GetMethod(nameof(NamedPolicyAttributes));
            var sut    = new TestAttributePolicyProvider();
            var policy = sut.GetSyncPolicy(GetTestContext(mi));

            policy.ShouldBeOfType <PolicyWrap>();

            var policyWrap = policy as PolicyWrap;
            var policies   = policyWrap.GetPolicies().OfType <TestPolicy>().ToArray();

            policies.Select(p => p.Order).ShouldBe(new[] { 0, 0 });
            policies.Select(p => p.Name).ShouldBe(new[] { "First", "Second" });
        }