public TestCaseBuilder UseLinkBuilderRelTransformation(Action <LinkTransformationBuilder> configureBuilder) { var builder = new LinkTransformationBuilder(); configureBuilder?.Invoke(builder); options.UseRelTransformation(builder.Build()); return(this); }
public static LinkTransformationBuilder AddModelPath(this LinkTransformationBuilder builder) { return(builder.Add("/models/").Add(ctx => { var returnType = ctx?.LinkSpec.RouteInfo?.MethodInfo?.ReturnType; var returnTypeInfo = returnType.GetTypeInfo(); if (returnTypeInfo.IsGenericType) { if (returnType.GetGenericTypeDefinition().IsAssignableFrom(typeof(Task <>))) { return GetTypePathInfo(returnType.GetGenericArguments()[0]); } } return GetTypePathInfo(returnType); })); }