private static object[] BuildMethodCallDependencyTestData(Type originType, string originMemberName, Type targetType, string targetMemberName) { var classMemberInfo = BuildMemberDependencyTestData(originType, originMemberName, targetType, targetMemberName); if (!(classMemberInfo.TargetMember is MethodMember targetMember)) { return(new object[] { null, null, null, null }); } var memberTypeDependency = new MethodCallDependency(classMemberInfo.OriginMember, new MethodMemberInstance(targetMember, Enumerable.Empty <GenericArgument>(), Enumerable.Empty <GenericArgument>())); object duplicateMemberTypeDependency = new MethodCallDependency(classMemberInfo.OriginMember, new MethodMemberInstance(targetMember, Enumerable.Empty <GenericArgument>(), Enumerable.Empty <GenericArgument>())); var dependencyReferenceDuplicate = memberTypeDependency; object objectReferenceDuplicate = memberTypeDependency; return(new[] { memberTypeDependency, duplicateMemberTypeDependency, dependencyReferenceDuplicate, objectReferenceDuplicate }); }
public static MethodCallDependency CreateStubMethodCallDependency(IMember originMember, MethodMember targetMember) { var methodCallDependency = new MethodCallDependency(originMember, targetMember); methodCallDependency.TargetMember.MemberBackwardsDependencies.Add(methodCallDependency); return(methodCallDependency); }
private MethodCallDependency CreateStubMethodCallDependencyForProperty(IType calledType, MethodReference methodReference, PropertyMember backedProperty) { var calledMethodMember = _typeFactory.CreateStubMethodMemberFromMethodReference(calledType, methodReference); var dependency = new MethodCallDependency(backedProperty, calledMethodMember); return(dependency); }
private static MethodCallDependency CreateStubMethodCallDependency(IMember originMember, MethodMember targetMember) { var methodCallDependency = new MethodCallDependency(originMember, new MethodMemberInstance(targetMember, Enumerable.Empty <GenericArgument>(), Enumerable.Empty <GenericArgument>())); methodCallDependency.TargetMember.MemberBackwardsDependencies.Add(methodCallDependency); return(methodCallDependency); }
private static object[] BuildMethodCallDependencyTestData(Type originType, string nameOfOriginMember, Type targetType, string nameOfTargetMember) { var originClass = Architecture.GetClassOfType(originType); var originMember = originClass.GetMembersWithName(nameOfOriginMember).Single(); var targetClass = Architecture.GetClassOfType(targetType); var targetMember = targetClass.GetMethodMembersWithName(nameOfTargetMember).Single(); var expectedDependency = new MethodCallDependency(originMember, targetMember); return(new object[] { originMember, expectedDependency }); }
public void AssertGetterMethodDependencies(PropertyMember propertyMember, Class mockTargetClass, MethodCallDependency expectedDependency) { Assert.NotEmpty(propertyMember.MemberDependencies); Assert.Single(propertyMember.GetMethodCallDependencies()); Assert.Contains(mockTargetClass, propertyMember.GetMethodCallDependencies().Select(dependency => dependency.Target)); Assert.Contains(expectedDependency.TargetMember.FullName, propertyMember.GetMethodCallDependencies() .Select(dependency => dependency.TargetMember.FullName)); }
public void MethodCallDependenciesAreFound(IMember originMember, MethodCallDependency expectedDependency) { Assert.True(originMember.HasMemberDependency(expectedDependency)); Assert.Contains(expectedDependency, originMember.GetMethodCallDependencies()); }