static RazorTestingEditorExtension CreateEditor(string text, bool isInCSharpContext, out string editorText,
                                                        out TestViewContent sev)
        {
            string parsedText;
            int    cursorPosition = text.IndexOf('$');
            int    endPos         = text.IndexOf('$', cursorPosition + 1);

            if (endPos == -1)
            {
                parsedText = editorText = text.Substring(0, cursorPosition) + text.Substring(cursorPosition + 1);
            }
            else
            {
                parsedText     = text.Substring(0, cursorPosition) + new string (' ', endPos - cursorPosition) + text.Substring(endPos + 1);
                editorText     = text.Substring(0, cursorPosition) + text.Substring(cursorPosition + 1, endPos - cursorPosition - 1) + text.Substring(endPos + 1);
                cursorPosition = endPos - 1;
            }

            var project = new AspMvc3Project("C#");

            project.FileName = UnitTests.TestBase.GetTempFile(".csproj");
            string file = UnitTests.TestBase.GetTempFile(extension);

            project.AddFile(file);

            var pcw = TypeSystemService.LoadProject(project);

            TypeSystemService.ForceUpdate(pcw);
            pcw.ReconnectAssemblyReferences();

            sev                = new TestViewContent();
            sev.Project        = project;
            sev.ContentName    = file;
            sev.Text           = editorText;
            sev.CursorPosition = cursorPosition;

            var tww = new TestWorkbenchWindow();

            tww.ViewContent = sev;

            var doc    = new Document(tww);
            var parser = new RazorTestingParser()
            {
                Doc = doc
            };
            var parsedDoc = parser.Parse(false, sev.ContentName, new StringReader(parsedText), project);

            return(new RazorTestingEditorExtension(doc, parsedDoc as RazorCSharpParsedDocument, isInCSharpContext));
        }
		static RazorTestingEditorExtension CreateEditor (string text, bool isInCSharpContext, out string editorText,
			out TestViewContent sev)
		{
			string parsedText;
			int cursorPosition = text.IndexOf ('$');
			int endPos = text.IndexOf ('$', cursorPosition + 1);
			if (endPos == -1)
				parsedText = editorText = text.Substring (0, cursorPosition) + text.Substring (cursorPosition + 1);
			else {
				parsedText = text.Substring (0, cursorPosition) + new string (' ', endPos - cursorPosition) + text.Substring (endPos + 1);
				editorText = text.Substring (0, cursorPosition) + text.Substring (cursorPosition + 1, endPos - cursorPosition - 1) + text.Substring (endPos + 1);
				cursorPosition = endPos - 1;
			}

			var project = new AspMvc3Project ("C#");
			project.FileName = UnitTests.TestBase.GetTempFile (".csproj");
			string file = UnitTests.TestBase.GetTempFile (extension);
			project.AddFile (file);

			var pcw = TypeSystemService.LoadProject (project);
			TypeSystemService.ForceUpdate (pcw);
			pcw.ReconnectAssemblyReferences ();

			sev = new TestViewContent ();
			sev.Project = project;
			sev.ContentName = file;
			sev.Text = editorText;
			sev.CursorPosition = cursorPosition;

			var tww = new TestWorkbenchWindow ();
			tww.ViewContent = sev;

			var doc = new Document (tww);
			var parser = new RazorTestingParser ()	{
				Doc = doc
			};
			var parsedDoc = parser.Parse (false, sev.ContentName, new StringReader (parsedText), project);

			return new RazorTestingEditorExtension (doc, parsedDoc as RazorCSharpParsedDocument, isInCSharpContext);
		}