public Task <NameResult> MapAsync(Type type, MethodInfo method) { type.ThrowIfNull("type"); method.ThrowIfNull("method"); NameAttribute attribute = method.GetCustomAttributes(typeof(NameAttribute), false).Cast <NameAttribute>().SingleOrDefault(); return((attribute != null ? NameResult.NameMapped(attribute.Name) : NameResult.NameNotMapped()).AsCompletedTask()); }
public Task <NameResult> MapAsync(Type type, MethodInfo method) { type.ThrowIfNull("type"); method.ThrowIfNull("method"); if (!type.NamespaceStartsWith(_rootNamespace)) { return(NameResult.NameNotMapped().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 name = String.Join(_wordSeparator, pathParts); return(NameResult.NameMapped(name).AsCompletedTask()); }
public void SetUp() { _result = NameResult.NameNotMapped(); }
public void SetUp() { _result = NameResult.NameMapped("name"); }