private Signature getTestFromScenario(string scenario)
        {
            var lines = splitToLines(_codeBehind);
            if (lines.Length == 0) return null;

            LineInfo line = null;
            if (scenario == null)
                line = new LineInfo() { Line = lines.Length - 1, Content = lines[lines.Length - 1] };
            else
                line = getFirstLine(lines, string.Format("(\"{0}\")", scenario));

            if (line == null)
                return null;
            var method = getMethod(getFirstLine(lines, "public* void*(", line.Line));
            var cls = getClass(getFirstLineRev(lines, "public * class", line.Line));
            if (cls == null)
                return null;
            var ns = getNamespace(getFirstLineRev(lines, "namespace ", line.Line));
            if (ns == null)
                return null;
            if (method != null)
                return new Signature(SignatureType.Method, string.Format("{0}.{1}.{2}", ns, cls, method));
            else
                return new Signature(SignatureType.Class, string.Format("{0}.{1}", ns, cls));
        }
 private string getNamespace(LineInfo lineInfo)
 {
     var pattern = "namespace ";
     var line = lineInfo.Content;
     var nsStart = line.IndexOf(pattern);
     if (nsStart == -1)
         return null;
     nsStart += pattern.Length;
     return line.Substring(nsStart, line.Length - nsStart).Trim();
 }
 private string getClass(LineInfo lineInfo)
 {
     var line = lineInfo.Content;
     var inheritStart = line.IndexOf(':');
     var genericStart = line.IndexOf('<');
     var newEnd = inheritStart > genericStart ? genericStart : inheritStart;
     if (newEnd > -1)
         line = line.Substring(0, newEnd);
     var pattern = " class ";
     var classStart = line.IndexOf(pattern);
     if (classStart == -1)
         return null;
     classStart += pattern.Length;
     return line.Substring(classStart, line.Length - classStart).Trim();
 }
 private string getMethod(LineInfo lineInfo)
 {
     if (lineInfo == null)
         return null;
     var end = lineInfo.Content.LastIndexOf('(');
     if (end == -1)
         return null;
     var start = lineInfo.Content.LastIndexOf(' ', end);
     if (start == -1)
         return null;
     return lineInfo.Content.Substring(start, end - start).Trim();
 }