public static CodeSuggestionsList GetSuggestions(string source)
        {
            var offset = source.IndexOf('$');
            source = source.Replace("$", "");
            var document = new ReadOnlyDocument(source);
            var caretLocation = document.OffsetToLocation(offset);

            var file = new SourceFile("Program.cs")
            {
                CompilationUnit = CSharpLanguage.Instance.Parse(document)
            };

            var assembly = new SourceAssembly("TestAssembly")
            {
                SourceFiles = { file }
            };

            var compilation = new Compilation(assembly);
            compilation.Assemblies.Add(new NetAssembly(CorlibAssembly, typeof(object).Assembly.Location));

            var engine = new CSharpCompletionEngine(document, file);

            return new CodeSuggestionsList(engine.GetSuggestions(caretLocation).ToList());
        }
        public void SingleFileSimpleNamespace()
        {
            var sourceFile = new SourceFile("dummy")
            {
                CompilationUnit = new CompilationUnit
                {
                    Namespaces =
                    {
                        new NamespaceDeclaration("MyNamespace")
                    }
                }
            };

            _sourceAssembly.SourceFiles.Add(sourceFile);
            var result = _compilation.GetScope().ResolveIdentifier("MyNamespace");
            Assert.IsInstanceOfType(result, typeof(NamespaceResolveResult));
            Assert.IsInstanceOfType(result.ScopeProvider, typeof(NamespaceDefinition));
            Assert.AreEqual("MyNamespace", ((NamespaceDefinition)result.ScopeProvider).FullName);
        }