public void BodyTypeDependenciesFound()
        {
            var bodyTypeDependencies =
                _methodWithTypeA.GetBodyTypeMemberDependencies().ToList();

            Assert.Equal("AABC", ClassWithBodyTypeA.MethodWithTypeA());
            Assert.True(bodyTypeDependencies.Count >= 3);
            Assert.Contains(_typeA, bodyTypeDependencies.Select(dependency => (Class)dependency.Target));
        }
Exemple #2
0
        public void AssignDependenciesInGeneratorMethodBody(MethodMember generator)
        {
            var accessedFieldMembers = generator.GetAccessedFieldMembers().ToList();
            var calledMethods        = generator.GetCalledMethods().ToList();
            var bodyTypes            = generator.GetBodyTypeMemberDependencies().Select(dep => dep.Target).ToList();

            Assert.Contains(_accessedBoolField, accessedFieldMembers);
            Assert.Contains(_accessedStaticField, accessedFieldMembers);
            Assert.Contains(_accessedStaticMethodAsField, accessedFieldMembers);
            Assert.Contains(_accessedConstructor, calledMethods);
            Assert.Contains(_accessedStaticMethodWithBody, calledMethods);
            Assert.Contains(_accessedClass, bodyTypes);
            Assert.Contains(bodyTypes, type => type.Name == "String");
            Assert.Contains(bodyTypes, type => type.Name == "Boolean");
            Assert.Contains(bodyTypes, type => type.Name == "Func`2");
        }
Exemple #3
0
 public static bool HasDependencyInMethodBodyTo(this MethodMember member, string pattern,
                                                bool useRegularExpressions = false)
 {
     return(member.GetBodyTypeMemberDependencies().Any(dependency =>
                                                       dependency.Target.FullNameMatches(pattern, useRegularExpressions)));
 }