internal void Update()
        {
            if (!needsUpdating)
            {
                return;
            }
            foreach (DotNetProject r in dom.ReferencedProjects)
            {
                var info = infoService.GetProjectInfo(r);
                if (info != null)
                {
                    info.Update();
                }
            }
            TypeSystemService.ForceUpdate(dom);
            objcTypes.Clear();
            cliTypes.Clear();
            refObjcTypes.Clear();
            refCliTypes.Clear();

            foreach (var type in infoService.GetRegisteredObjects(dom, dom.Compilation.MainAssembly))
            {
                if (objcTypes.ContainsKey(type.ObjCName))
                {
                    var other = objcTypes[type.ObjCName];
                    throw new ArgumentException(string.Format("Multiple types ({0} and {1}) registered with the same Objective-C name: {2}", type.CliName, other.CliName, type.ObjCName));
                }

                objcTypes.Add(type.ObjCName, type);
                cliTypes.Add(type.CliName, type);
            }

            foreach (var refAssembly in dom.Compilation.ReferencedAssemblies)
            {
                foreach (var type in infoService.GetRegisteredObjects(dom, refAssembly))
                {
                    if (refObjcTypes.ContainsKey(type.ObjCName))
                    {
                        var other = refObjcTypes[type.ObjCName];
                        throw new ArgumentException(string.Format("Multiple types ({0} and {1}) registered with the same Objective-C name: {2}", type.CliName, other.CliName, type.ObjCName));
                    }

                    refObjcTypes.Add(type.ObjCName, type);
                    refCliTypes.Add(type.CliName, type);
                }
            }

            foreach (var type in cliTypes.Values)
            {
                ResolveCliToObjc(type);
            }

            needsUpdating = false;
        }
        static WebFormsTestingEditorExtension CreateEditor(string text, string extension, 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 AspNetAppProject("C#");

            project.References.Add(new ProjectReference(ReferenceType.Package, "System"));
            project.References.Add(new ProjectReference(ReferenceType.Package, "System.Web"));
            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 TestDocument(tww);

            doc.Editor.Document.FileName = sev.ContentName;
            var parser    = new WebFormsParser();
            var parsedDoc = (WebFormsParsedDocument)parser.Parse(false, sev.ContentName, new StringReader(parsedText), project);

            doc.HiddenParsedDocument = parsedDoc;

            return(new WebFormsTestingEditorExtension(doc));
        }
        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.ReloadAssemblyReferences(project);

            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));
        }