public void IsExcludedIServiceBehavior1s()
        {
            // Arrange
            var sb     = new ServiceBehaviorThirdParty();
            var attrib = new ExcludedServiceBehaviorsAttribute("ServiceBehavior1");

            // Act & Assert
            Assert.IsFalse(ServiceBehaviorApplicator.IsIncluded(sb, attrib));
        }
        public void IsExcludedServiceBehaviorByTypeFalseTests()
        {
            // Arrange
            var sb     = new ServiceBehavior1();
            var attrib = new ExcludedServiceBehaviorTypesAttribute(ServiceBehaviorType.Authenticator);

            // Act & Assert
            Assert.IsTrue(ServiceBehaviorApplicator.IsExcluded(sb, attrib));
        }
        public void IsExcludedServiceBehaviorBaseFalseTests()
        {
            // Arrange
            var sb     = new ServiceBehavior1();
            var attrib = new ExcludedServiceBehaviorsAttribute("ServiceBehaviorBogus");

            // Act & Assert
            Assert.IsFalse(ServiceBehaviorApplicator.IsExcluded(sb, attrib));
        }
        public void IsIncludedServiceBehaviorBaseTrueTests()
        {
            // Arrange
            var sb     = new ServiceBehavior1();
            var attrib = new IncludedServiceBehaviorsAttribute("ServiceBehavior1");

            // Act & Assert
            Assert.IsTrue(ServiceBehaviorApplicator.IsIncluded(sb, attrib));
        }
        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));
        }
        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]);
        }
        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);
        }