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());
        }
示例#2
0
        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());
        }
示例#3
0
 public void SetUp()
 {
     _result = NameResult.NameNotMapped();
 }
示例#4
0
 public void SetUp()
 {
     _result = NameResult.NameMapped("name");
 }