Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 3
0
 public void SetUp()
 {
     _result = NameResult.NameNotMapped();
 }
Ejemplo n.º 4
0
 public void SetUp()
 {
     _result = NameResult.NameMapped("name");
 }