public void IsComponent(Type type, bool expected) { // Arrange & Act var result = ViewComponentConventions.IsComponent(type.GetTypeInfo()); // Assert Assert.Equal(expected, result); }
/// <summary> /// Determines whether or not the given <see cref="TypeInfo"/> is a view component class. /// </summary> /// <param name="typeInfo">The <see cref="TypeInfo"/>.</param> /// <returns> /// <c>true</c> if <paramref name="typeInfo"/>represents a view component class, otherwise <c>false</c>. /// </returns> protected virtual bool IsViewComponentType(TypeInfo typeInfo) { if (typeInfo == null) { throw new ArgumentNullException(nameof(typeInfo)); } return(ViewComponentConventions.IsComponent(typeInfo)); }
private static ViewComponentDescriptor CreateCandidate(TypeInfo typeInfo) { var candidate = new ViewComponentDescriptor() { FullName = ViewComponentConventions.GetComponentFullName(typeInfo), ShortName = ViewComponentConventions.GetComponentName(typeInfo), Type = typeInfo.AsType(), }; return(candidate); }
private static ViewComponentDescriptor CreateDescriptor(TypeInfo typeInfo) { var type = typeInfo.AsType(); var candidate = new ViewComponentDescriptor { FullName = ViewComponentConventions.GetComponentFullName(typeInfo), ShortName = ViewComponentConventions.GetComponentName(typeInfo), Type = type, MethodInfo = FindMethod(type) }; return(candidate); }
/// <summary> /// Determines whether or not the given <see cref="TypeInfo"/> is a View Component class. /// </summary> /// <param name="typeInfo">The <see cref="TypeInfo"/>.</param> /// <returns> /// <c>true</c> if <paramref name="typeInfo"/>represents a View Component class, otherwise <c>false</c>. /// </returns> protected virtual bool IsViewComponentType([NotNull] TypeInfo typeInfo) { return(ViewComponentConventions.IsComponent(typeInfo)); }