Esempio n. 1
0
            public void DoesNotAttemptToMatchInterfaces()
            {
                InterfaceType interfaceType = new InterfaceType
                                              (
                    "myInterfaceFqn",
                    "myPackage",
                    "myInterface",
                    "myNamespace"
                                              );

                Symbols.MapFullyQualifiedNameToType("myInterfaceFqn", interfaceType);

                ClassType classType = new ClassType
                                      (
                    "myClassFqn",
                    "myPackage",
                    "myClass",
                    "myNamespace",
                    false,
                    interfaces: new[] { new TypeReference("myInterfaceFqn") }
                                      );

                Symbols.MapFullyQualifiedNameToType("myClassFqn", classType);

                bool actual = classType.AnyAncestor(Symbols, t => t.Name == "myInterface");

                Assert.False(actual);
            }
            public void DoesNotAttemptToMatchInterfaces()
            {
                InterfaceType interfaceType = new InterfaceType
                                              (
                    fullyQualifiedName: "myInterfaceFqn",
                    assembly: "myPackage",
                    name: "myInterface"
                                              );

                Symbols.MapFullyQualifiedNameToType("myInterfaceFqn", interfaceType);

                ClassType classType = new ClassType
                                      (
                    fullyQualifiedName: "myClassFqn",
                    assembly: "myPackage",
                    name: "myClass",
                    isAbstract: false,
                    interfaces: new[] { "myInterfaceFqn" }
                                      );

                Symbols.MapFullyQualifiedNameToType("myClassFqn", classType);

                bool actual = classType.AnyAncestor(Symbols, t => t.Name == "myInterface");

                Assert.False(actual);
            }
Esempio n. 3
0
            public void ReturnsTrueIfAncestorMatches()
            {
                ClassType classType = CreateType(true, true);

                bool actual = classType.AnyAncestor(Symbols, t => t.Name == "myGrandParentType");

                Assert.True(actual);
            }
Esempio n. 4
0
            public void ReturnsFalseIfNoAncestorMatches()
            {
                ClassType classType = CreateType(true, true);

                bool actual = classType.AnyAncestor(Symbols, t => t.Name == "myNephewType");

                Assert.False(actual);
            }
Esempio n. 5
0
            public void ReturnsFalseIfNoAncestorExists()
            {
                ClassType classType = CreateType(false, false);

                bool actual = classType.AnyAncestor(Symbols, t => t.Name != string.Empty);

                Assert.False(actual);
            }
Esempio n. 6
0
            public void DoesNotAttemptToMatchSelf()
            {
                ClassType classType = CreateType(true, true);

                bool actual = classType.AnyAncestor(Symbols, t => t.Name == "myClass");

                Assert.False(actual);
            }