Exemple #1
0
        public void When_IncludeBaseType_is_true_base_type_matches_requirements()
        {
            var attribute = new InheritsAttribute(typeof(IParentInterface))
            {
                IncludeBaseType = true
            };

            Assert.That(attribute.MatchesRequirements(typeof(IParentInterface)), Is.True);
        }
Exemple #2
0
        public void When_abstract_class_is_base_type_and_IncludeBaseType_is_true_it_matches_requirements()
        {
            var attribute = new InheritsAttribute(typeof(ParentAbstractClass))
            {
                IncludeBaseType = true
            };

            Assert.That(attribute.MatchesRequirements(typeof(ParentAbstractClass)), Is.True);
        }
Exemple #3
0
        public void When_interface_is_base_type_and_AllowAbstract_is_true_derived_interfaces_match_requirements()
        {
            var attribute = new InheritsAttribute(typeof(IParentInterface))
            {
                IncludeBaseType = true
            };

            Assert.That(attribute.MatchesRequirements(typeof(IChildInterface)), Is.False);
        }
Exemple #4
0
        public void Abstract_classes_are_not_included_by_default()
        {
            var attribute = new InheritsAttribute(typeof(IParentInterface));

            Assert.That(attribute.MatchesRequirements(typeof(ParentAbstractClass)), Is.False);
        }
Exemple #5
0
        public void Base_type_does_not_match_requirements_by_default()
        {
            var attribute = new InheritsAttribute(typeof(IParentInterface));

            Assert.That(attribute.MatchesRequirements(typeof(IParentInterface)), Is.False);
        }
Exemple #6
0
        public void When_interface_is_base_type_a_struct_that_implements_it_matches_requirements()
        {
            var attribute = new InheritsAttribute(typeof(IParentInterface));

            Assert.That(attribute.MatchesRequirements(typeof(ChildStruct)), Is.True);
        }
Exemple #7
0
        public void When_interface_is_base_type_derived_interfaces_do_not_match_requirements()
        {
            var attribute = new InheritsAttribute(typeof(IParentInterface));

            Assert.That(attribute.MatchesRequirements(typeof(IChildInterface)), Is.False);
        }