public Task <ResolvedRelativeUrlResult> MapAsync(Type type, MethodInfo method) { type.ThrowIfNull("type"); method.ThrowIfNull("method"); ResolvedRelativeUrlAttribute attribute = method.GetCustomAttributes(typeof(ResolvedRelativeUrlAttribute), false).Cast <ResolvedRelativeUrlAttribute>().SingleOrDefault(); return((attribute != null ? ResolvedRelativeUrlResult.ResolvedRelativeUrlMapped(attribute.ResolvedRelativeUrl) : ResolvedRelativeUrlResult.ResolvedRelativeUrlNotMapped()).AsCompletedTask()); }
public Task <ResolvedRelativeUrlResult> MapAsync(Type type, MethodInfo method) { type.ThrowIfNull("type"); method.ThrowIfNull("method"); if (!type.NamespaceStartsWith(_rootNamespace)) { return(ResolvedRelativeUrlResult.ResolvedRelativeUrlNotMapped().AsCompletedTask()); } var pathParts = new List <string>(); string relativeNamespace = Regex.Replace(type.Namespace, String.Format(@"^{0}\.?(?<RelativeNamespace>.*)", Regex.Escape(_rootNamespace)), "${RelativeNamespace}"); pathParts.AddRange(ParseWords(relativeNamespace)); pathParts.AddRange(ParseWords(type.Name)); string resolvedRelativeUrl = String.Join("/", pathParts); return(ResolvedRelativeUrlResult.ResolvedRelativeUrlMapped(resolvedRelativeUrl).AsCompletedTask()); }
public void SetUp() { _result = ResolvedRelativeUrlResult.ResolvedRelativeUrlNotMapped(); }
public void SetUp() { _result = ResolvedRelativeUrlResult.ResolvedRelativeUrlMapped("relative"); }