コード例 #1
0
        public void IsExcludedIServiceBehavior1s()
        {
            // Arrange
            var sb     = new ServiceBehaviorThirdParty();
            var attrib = new ExcludedServiceBehaviorsAttribute("ServiceBehavior1");

            // Act & Assert
            Assert.IsFalse(ServiceBehaviorApplicator.IsIncluded(sb, attrib));
        }
コード例 #2
0
        public void IsExcludedServiceBehaviorByTypeFalseTests()
        {
            // Arrange
            var sb     = new ServiceBehavior1();
            var attrib = new ExcludedServiceBehaviorTypesAttribute(ServiceBehaviorType.Authenticator);

            // Act & Assert
            Assert.IsTrue(ServiceBehaviorApplicator.IsExcluded(sb, attrib));
        }
コード例 #3
0
        public void IsExcludedServiceBehaviorBaseFalseTests()
        {
            // Arrange
            var sb     = new ServiceBehavior1();
            var attrib = new ExcludedServiceBehaviorsAttribute("ServiceBehaviorBogus");

            // Act & Assert
            Assert.IsFalse(ServiceBehaviorApplicator.IsExcluded(sb, attrib));
        }
コード例 #4
0
        public void IsIncludedServiceBehaviorBaseTrueTests()
        {
            // Arrange
            var sb     = new ServiceBehavior1();
            var attrib = new IncludedServiceBehaviorsAttribute("ServiceBehavior1");

            // Act & Assert
            Assert.IsTrue(ServiceBehaviorApplicator.IsIncluded(sb, attrib));
        }
コード例 #5
0
        public void AddServiceBehaviorConflictingAttributesTest()
        {
            // Arrange
            List <Attribute> attributes = new List <Attribute> {
                new IncludedServiceBehaviorsAttribute(), new ExcludedServiceBehaviorsAttribute()
            };
            var behaviors       = new KeyedByTypeCollection <IServiceBehavior>();
            var pluginBehaviors = new List <IServiceBehavior> {
                new ServiceBehavior1()
            };

            // Act and Assert
            Assert.ThrowsException <ConflictingAttributesException>(() => ServiceBehaviorApplicator.AddServiceBehavior(attributes, behaviors, pluginBehaviors));
        }
コード例 #6
0
        public void AddServiceBehaviorNullAttributesListTest()
        {
            // Arrange
            List <Attribute> attributes = null;
            var behaviors       = new KeyedByTypeCollection <IServiceBehavior>();
            var pluginBehaviors = new List <IServiceBehavior> {
                new ServiceBehavior1()
            };

            // Act
            ServiceBehaviorApplicator.AddServiceBehavior(attributes, behaviors, pluginBehaviors);

            // Assert
            Assert.AreEqual(behaviors[0], pluginBehaviors[0]);
        }
コード例 #7
0
        public void AddServiceBehaviorIsExcludedByTypeAttributesTest()
        {
            // Arrange
            List <Attribute> attributes = new List <Attribute> {
                new ExcludedServiceBehaviorTypesAttribute(ServiceBehaviorType.Authenticator)
            };
            var behaviors       = new KeyedByTypeCollection <IServiceBehavior>();
            var pluginBehaviors = new List <IServiceBehavior> {
                new ServiceBehavior1()
            };

            // Act
            ServiceBehaviorApplicator.AddServiceBehavior(attributes, behaviors, pluginBehaviors);

            // Act and Assert
            Assert.AreEqual(0, behaviors.Count);
        }