private static void AssertAreSameMethod(MethodInfo methodInfo, MethodInfoSlim methodInfoSlim) { Assert.IsTrue(TypeSlimExtensions.Equals(methodInfo.ReturnType.ToTypeSlim(), methodInfoSlim.ReturnType)); Assert.IsTrue(methodInfoSlim.ParameterTypes.SequenceEqual(methodInfo.GetParameters().Select(p => p.ParameterType.ToTypeSlim()))); switch (methodInfoSlim.Kind) { case MethodInfoSlimKind.Simple: AssertAreSameSimpleMethod(methodInfo, (SimpleMethodInfoSlim)methodInfoSlim); return; case MethodInfoSlimKind.GenericDefinition: Assert.IsTrue(methodInfo.IsGenericMethodDefinition); AssertAreSameGenericDefinitionMethod(methodInfo, (GenericDefinitionMethodInfoSlim)methodInfoSlim); return; case MethodInfoSlimKind.Generic: AssertAreSameGenericMethod(methodInfo, (GenericMethodInfoSlim)methodInfoSlim); return; } Fail(methodInfo, methodInfoSlim); }
private static void AssertAreSameProperty(PropertyInfo propertyInfo, PropertyInfoSlim propertyInfoSlim) { Assert.AreEqual(propertyInfo.Name, propertyInfoSlim.Name); Assert.IsTrue(TypeSlimExtensions.Equals(propertyInfo.DeclaringType.ToTypeSlim(), propertyInfoSlim.DeclaringType)); Assert.IsTrue(TypeSlimExtensions.Equals(propertyInfo.PropertyType.ToTypeSlim(), propertyInfoSlim.PropertyType)); }
private static void AssertAreSameField(FieldInfo fieldInfo, FieldInfoSlim fieldInfoSlim) { Assert.AreEqual(fieldInfo.Name, fieldInfoSlim.Name); Assert.IsTrue(TypeSlimExtensions.Equals(fieldInfo.DeclaringType.ToTypeSlim(), fieldInfoSlim.DeclaringType)); Assert.IsTrue(TypeSlimExtensions.Equals(fieldInfo.FieldType.ToTypeSlim(), fieldInfoSlim.FieldType)); }
private static void AssertAreSameConstructor(ConstructorInfo constructorInfo, ConstructorInfoSlim constructorInfoSlim) { Assert.IsTrue(TypeSlimExtensions.Equals(constructorInfo.DeclaringType.ToTypeSlim(), constructorInfoSlim.DeclaringType)); Assert.IsTrue(constructorInfoSlim.ParameterTypes.SequenceEqual(constructorInfo.GetParameters().Select(p => p.ParameterType.ToTypeSlim()))); }