Ejemplo n.º 1
0
        public void LoadExtendsTest(string className, string baseClassName)
        {
            var csFile = new CSharpFile(
                className.ToBasicPath(),
                DeclarationHelper.CreateDeclarationFactory(this.testOutputHelper));

            csFile.Load();

            var declaration = Assert.Single(csFile.Declarations);

            var declarationResolver = this.SetupDeclarationResolver(
                declaration,
                baseClassName);

            var classDecl = Assert.IsType <ClassDeclaration>(declaration);

            classDecl.Load(declarationResolver);

            Assert.NotNull(classDecl.GenericParameters);
            Assert.NotNull(classDecl.Extends);

            var extendsSingle = Assert.Single(classDecl.Extends);

            var genDeclUse = Assert.IsType <GenericDeclarationUse>(extendsSingle);

            Assert.Equal(baseClassName, genDeclUse.Declaration.Name);
        }
        public void LoadClassAttributes()
        {
            var type        = typeof(AttributedClass);
            var declaration = DeclarationHelper.CreateDeclarationFactory(this.testOutputHelper)
                              .CreateClassDeclaration(type);

            Assert.NotNull(declaration);
            Assert.Equal(
                ReflectionGenericDeclarationLoader <SyntaxNode> .GetNameWithoutGeneric(type.Name),
                declaration.Name);

            var classDeclaration = Assert.IsType <ClassDeclaration>(declaration);

            var declarationResolverMock = new Mock <IDeclarationResolver>();

            classDeclaration.Load(declarationResolverMock.Object);

            Assert.NotNull(declaration.Attributes);
            var attribute = Assert.Single(declaration.Attributes);

            Assert.Equal(nameof(PatternAttribute), attribute.Name);

            Assert.NotNull(attribute.SyntaxNodeProvider);

            var node = attribute.SyntaxNodeProvider.SyntaxNode;

            Assert.NotNull(node);

            var attrText = node.ToString();

            Assert.Contains(nameof(PatternAttribute), attrText, StringComparison.OrdinalIgnoreCase);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Get global declaration in the current lua model
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public Declaration GetGlobalDeclaration(string name)
        {
            if (_root == null)
            {
                return(null);
            }
            List <Declaration> foundedDeclarations = new List <Declaration>();
            // build a declaration with dummy scope span
            Declaration declaration = DeclarationHelper.BuildDeclaration(name);

            GetGlobalDeclarationsByName(_root, declaration, foundedDeclarations);
            foundedDeclarations.Sort(delegate(Declaration a, Declaration b)
            {
                if (a.Scope.StartPosition >= b.Scope.StartPosition &&
                    a.Scope.EndPosition <= b.Scope.EndPosition)
                {
                    return(-1);
                }
                else
                {
                    return(1);
                }
            });

            if (foundedDeclarations.Count > 0)
            {
                return(foundedDeclarations[0]);
            }

            return(null);
        }
        private IDeclarationResolver LoadWorkSpace(
            string patternInterfaceFile,
            string patternImplementationFile,
            string declarationInterfaceFile,
            out IInterfaceDeclaration itfDeclaration,
            out IInterfaceDeclaration itfPatternDeclaration,
            out IClassDeclaration implPatternDeclaration,
            out IEnumerable <ICSharpFile> files)
        {
            using (var ws = new CSharpWorkspace(
                       Mock.Of <ILogger <CSharpWorkspace> >(),
                       new CSharpFactory(
                           Mock.Of <ILoggerFactory>(),
                           DeclarationHelper.CreateDeclarationFactory(this.testOutputHelper)),
                       new CSharpLoader()))
            {
                itfDeclaration = ws.RegisterFile(declarationInterfaceFile)
                                 .Declarations.First() as IInterfaceDeclaration;
                itfPatternDeclaration = ws.RegisterFile(patternInterfaceFile)
                                        .Declarations.First() as IInterfaceDeclaration;
                implPatternDeclaration = ws.RegisterFile(patternImplementationFile)
                                         .Declarations.First() as IClassDeclaration;

                files = ws.Files;

                return(ws.DeepLoad());
            }
        }
        public void DeepLoadTest()
        {
            var factoryMock = new Mock <ICSharpFactory>();
            var loaderMock  = new Mock <ICSharpLoader>();

            using (var workspace = new CSharpWorkspace(
                       new TestLogger <CSharpWorkspace>(this.testOutputHelper),
                       factoryMock.Object,
                       loaderMock.Object))
            {
                var fileMock = new Mock <ICSharpFile>();

                var declaration = DeclarationHelper.SetupDeclaration <IDeclaration <SyntaxNode> >("nameSpace", "name");

                fileMock.SetupGet(f => f.Declarations).Returns(new IDeclaration <SyntaxNode>[] { declaration });

                factoryMock.Setup(f => f.CreateFile(It.IsAny <string>()))
                .Returns <string>(f => fileMock.Object);

                workspace.RegisterFile("Test");

                workspace.DeepLoad();

                loaderMock.Verify(l => l.Load(It.IsAny <IDeclarationResolver>(), declaration));
            }
        }
Ejemplo n.º 6
0
        private IDeclarationResolver SetupDeclarationResolver(IDeclaration <SyntaxNode> contextDeclaration, params string[] classNames)
        {
            var declarationResolverMock = new Mock <IDeclarationResolver>();

            foreach (var className in classNames)
            {
                var classFile = new CSharpFile(
                    className.ToBasicPath(),
                    DeclarationHelper.CreateDeclarationFactory(this.testOutputHelper));
                classFile.Load();
                var classDeclarationSingle = Assert.Single(classFile.Declarations);
                if (classDeclarationSingle is IGenericDeclaration <SyntaxNode> genericDeclaration &&
                    genericDeclaration.TypeParameterListSyntaxProvider.SyntaxNode != null)
                {
                    declarationResolverMock
                    .Setup(dr => dr.Resolve(genericDeclaration.Name, It.IsAny <IReadOnlyList <IDeclarationUse <SyntaxNode> > >(), contextDeclaration))
                    .Returns(genericDeclaration);
                }
                else
                {
                    declarationResolverMock
                    .Setup(dr => dr.Resolve(classDeclarationSingle.Name, contextDeclaration))
                    .Returns(classDeclarationSingle);
                }
            }

            return(declarationResolverMock.Object);
        }
        public void ResolveDeclarationTest(
            string nameSpace, string name, string ctxNameSpace, string usingNameSpace, string nameToResolve, bool expectedMatch)
        {
            var declaration = DeclarationHelper.SetupDeclaration <IDeclaration <SyntaxNode> >(nameSpace, name);

            var contextDeclaration = DeclarationHelper.SetupDeclaration <IDeclaration <SyntaxNode> >(ctxNameSpace, "ctxName", m =>
            {
                var usingDirectives = string.IsNullOrEmpty(usingNameSpace) ? Array.Empty <string>() : new[] { usingNameSpace };
                m.SetupGet(d => d.UsingDirectives).Returns(usingDirectives);
            });

            var declResolver = new DeclarationResolver(new[] { declaration }, (r, d) => { });

            var resolvedDecl = declResolver.Resolve(nameToResolve, contextDeclaration);

            if (expectedMatch)
            {
                Assert.NotNull(resolvedDecl);
                Assert.Same(declaration, resolvedDecl);
            }
            else
            {
                Assert.Null(resolvedDecl);
            }
        }
        public void LoadGetterSetterPropertyTest()
        {
            var type = typeof(ClassWithGetterSetterProperties);

            var declarationFactory = DeclarationHelper.CreateDeclarationFactory(this.testOutputHelper);
            var declaration        = declarationFactory.CreateClassDeclaration(type);

            var classDeclaration = Assert.IsType <ClassDeclaration>(declaration);

            var declarationResolverMock = new Mock <IDeclarationResolver>();

            classDeclaration.Load(declarationResolverMock.Object);

            Assert.NotEmpty(classDeclaration.Properties);
            Assert.Equal(3, classDeclaration.Properties.Count);

            var rwp = Assert.Single(classDeclaration.Properties.Where(p => p.Name == nameof(ClassWithGetterSetterProperties.ReadWriteProperty)));

            Assert.True(rwp.HasGetter);
            Assert.True(rwp.HasSetter);

            var rop = Assert.Single(classDeclaration.Properties.Where(p => p.Name == nameof(ClassWithGetterSetterProperties.ReadOnlyProperty)));

            Assert.True(rop.HasGetter);
            Assert.False(rop.HasSetter);

            var wop = Assert.Single(classDeclaration.Properties.Where(p => p.Name == nameof(ClassWithGetterSetterProperties.WriteOnlyProperty)));

            Assert.False(wop.HasGetter);
            Assert.True(wop.HasSetter);
        }
Ejemplo n.º 9
0
        public void LoadClassAttributes()
        {
            var className = nameof(AttributedClass);
            var file      = className.ToBasicPath();

            var csFile = new CSharpFile(
                file,
                DeclarationHelper.CreateDeclarationFactory(this.testOutputHelper));

            csFile.Load();

            var declaration = Assert.Single(csFile.Declarations);

            var declarationResolver = this.SetupDeclarationResolver(declaration);

            var decl = Assert.IsType <ClassDeclaration>(declaration);

            decl.Load(declarationResolver);

            Assert.NotEmpty(decl.Attributes);
            var attribute = Assert.Single(decl.Attributes);

            Assert.Equal(nameof(PatternAttribute), attribute.Name);

            Assert.NotNull(attribute.SyntaxNodeProvider);
        }
Ejemplo n.º 10
0
        public void BasicCSharpFileTest()
        {
            var file = "./Resources/Workspace/BasicClass.cs";

            var csFile = new CSharpFile(file, DeclarationHelper.CreateDeclarationFactory(this.testOutputHelper));

            Assert.Equal(Path.GetFileName(file), csFile.FileName);
            Assert.Equal(Path.GetDirectoryName(file), csFile.FilePath);
        }
Ejemplo n.º 11
0
        internal Declaration GetDeclarationFromPredeined(string name)
        {
            Declaration declaration = DeclarationHelper.BuildDeclaration(name);
            var         founded     = _predefinedDeclarations.Where((defined) => defined.Equal(declaration));

            if (founded.Count() != 0)
            {
                return(founded.First());
            }
            return(null);
        }
        private ClassDeclaration LoadClassDeclarationFrom(Type type)
        {
            var declaration = DeclarationHelper.CreateDeclarationFactory(this.testOutputHelper)
                              .CreateClassDeclaration(type);

            var classDeclaration        = Assert.IsType <ClassDeclaration>(declaration);
            var declarationResolverMock = new Mock <IDeclarationResolver>();

            classDeclaration.Load(declarationResolverMock.Object);
            return(classDeclaration);
        }
        public void FindDeclarationTest()
        {
            var declaration = DeclarationHelper.SetupDeclaration <IDeclaration <SyntaxNode> >("ns", "name");

            var declResolver = new DeclarationResolver(new[] { declaration }, null);

            var fundDecl = Assert.Single(declResolver.Find(declaration.FullName));

            Assert.Same(declaration, fundDecl);

            Assert.Null(declResolver.Find("unknown"));
        }
Ejemplo n.º 14
0
        public void LoadCSharpFileNameSpaceDeclarationTest()
        {
            var file = "./Resources/Workspace/MultiNameSapces.cs";

            var csFile = new CSharpFile(file, DeclarationHelper.CreateDeclarationFactory(this.testOutputHelper));

            csFile.Load();

            Assert.Equal(3, csFile.Declarations.Count);

            Assert.Single(csFile.Declarations.Where(d => string.IsNullOrEmpty(d.DeclarationNameSpace)));
            Assert.Single(csFile.Declarations.Where(d => d.DeclarationNameSpace == "SoloX.GeneratorTools.Core.CSharp.UTest.Resources.Workspace"));
            Assert.Single(csFile.Declarations.Where(d => d.DeclarationNameSpace == "SoloX.GeneratorTools.Core.CSharp.UTest.Resources.Workspace.Test"));
        }
Ejemplo n.º 15
0
        public void LoadCSharpFileTest(string declarationFile, string name, Type expectedDeclarationType)
        {
            var csFile = new CSharpFile(
                declarationFile,
                DeclarationHelper.CreateDeclarationFactory(this.testOutputHelper));

            csFile.Load();

            Assert.Single(csFile.Declarations);
            var decl = csFile.Declarations.Single();

            Assert.Equal(expectedDeclarationType, decl.GetType());
            Assert.Equal(name, decl.Name);
        }
Ejemplo n.º 16
0
        public void LoadMemberListTest(string className, bool isArray)
        {
            var file = className.ToBasicPath();

            var csFile = new CSharpFile(
                file,
                DeclarationHelper.CreateDeclarationFactory(this.testOutputHelper));

            csFile.Load();

            var declaration = Assert.Single(csFile.Declarations);

            var declarationResolver = this.SetupDeclarationResolver(
                declaration,
                nameof(SimpleClass));

            var decl = Assert.IsType <ClassDeclaration>(declaration);

            decl.Load(declarationResolver);

            Assert.Empty(decl.GenericParameters);
            Assert.Empty(decl.Extends);

            Assert.NotEmpty(decl.Members);
            Assert.Equal(2, decl.Members.Count);

            var mClass = Assert.Single(decl.Members.Where(m => m.Name == nameof(ClassWithProperties.PropertyClass)));
            var pClass = Assert.IsType <PropertyDeclaration>(mClass);

            Assert.IsType <GenericDeclarationUse>(pClass.PropertyType);
            Assert.Equal(nameof(SimpleClass), pClass.PropertyType.Declaration.Name);

            var mInt = Assert.Single(decl.Members.Where(m => m.Name == nameof(ClassWithProperties.PropertyInt)));
            var pInt = Assert.IsType <PropertyDeclaration>(mInt);

            Assert.IsType <PredefinedDeclarationUse>(pInt.PropertyType);
            Assert.Equal("int", pInt.PropertyType.Declaration.Name);

            if (isArray)
            {
                Assert.NotNull(pClass.PropertyType.ArraySpecification);
                Assert.NotNull(pInt.PropertyType.ArraySpecification);
            }
            else
            {
                Assert.Null(pClass.PropertyType.ArraySpecification);
                Assert.Null(pInt.PropertyType.ArraySpecification);
            }
        }
Ejemplo n.º 17
0
        public void LoadCSharpAssemblyTest()
        {
            var assembly   = typeof(CSharpAssemblyTest).Assembly;
            var csAssembly = new CSharpAssembly(
                new TestLogger <CSharpAssembly>(this.testOutputHelper),
                DeclarationHelper.CreateDeclarationFactory(this.testOutputHelper),
                assembly);

            csAssembly.Load();

            Assert.Same(assembly, csAssembly.Assembly);
            var decl = Assert.Single(csAssembly.Declarations.Where(d => d.Name == nameof(BasicInterface)));

            var typeItfDecl = Assert.IsType <InterfaceDeclaration>(decl);

            Assert.Same(typeof(BasicInterface), typeItfDecl.GetData <Type>());
        }
        public void ResolveGenericDeclarationTest(
            string nameSpace, string name, string nameParam, string ctxNameSpace, string usingNameSpace, string nameToResolve, bool expectedMatch)
        {
            var genericParameter   = Mock.Of <IGenericParameterDeclaration>();
            var genericDeclaration = DeclarationHelper.SetupDeclaration <IGenericDeclaration <SyntaxNode> >(nameSpace, name, mock =>
            {
                mock.SetupGet(x => x.GenericParameters).Returns(new[] { genericParameter });
            });

            var contextDeclaration = DeclarationHelper.SetupDeclaration <IDeclaration <SyntaxNode> >(ctxNameSpace, "ctxName", m =>
            {
                var usingDirectives = string.IsNullOrEmpty(usingNameSpace) ? Array.Empty <string>() : new[] { usingNameSpace };
                m.SetupGet(d => d.UsingDirectives).Returns(usingDirectives);
            });

            var declarationParam     = DeclarationHelper.SetupDeclaration <IDeclaration <SyntaxNode> >(nameSpace, nameParam);
            var declarationParamUse1 = DeclarationHelper.SetupDeclarationUse <IDeclarationUse <SyntaxNode> >(declarationParam);
            var declarationParamUse2 = DeclarationHelper.SetupDeclarationUse <IDeclarationUse <SyntaxNode> >(declarationParam);

            var declResolver = new DeclarationResolver(new[] { genericDeclaration }, (r, d) => { });

            var resolvedGenericDecl1 = declResolver.Resolve(
                nameToResolve,
                new[] { declarationParamUse1 },
                contextDeclaration);
            var resolvedGenericDecl2 = declResolver.Resolve(
                nameToResolve,
                new[] { declarationParamUse1, declarationParamUse2 },
                contextDeclaration);

            var resolvedDecl = declResolver.Resolve(nameToResolve, contextDeclaration);

            Assert.Null(resolvedDecl);
            Assert.Null(resolvedGenericDecl2);

            if (expectedMatch)
            {
                Assert.NotNull(resolvedGenericDecl1);
                Assert.Same(genericDeclaration, resolvedGenericDecl1);
            }
            else
            {
                Assert.Null(resolvedGenericDecl1);
            }
        }
        private IDeclarationResolver LoadAndGetResolver(string projectFile, int expectedProjectCount)
        {
            using (var ws = new CSharpWorkspace(
                       new TestLogger <CSharpWorkspace>(this.testOutputHelper),
                       new CSharpFactory(
                           this.testLoggerFactory,
                           DeclarationHelper.CreateDeclarationFactory(this.testOutputHelper)),
                       new CSharpLoader()))
            {
                ws.RegisterProject(projectFile);

                Assert.Equal(expectedProjectCount, ws.Projects.Count);

                Assert.NotEmpty(ws.Files);

                return(ws.DeepLoad());
            }
        }
        public void LoadExtendsTest(Type type, string baseClassName)
        {
            var declaration = DeclarationHelper.CreateDeclarationFactory(this.testOutputHelper)
                              .CreateClassDeclaration(type);

            var classDeclaration = Assert.IsType <ClassDeclaration>(declaration);

            var declarationResolverMock = new Mock <IDeclarationResolver>();

            classDeclaration.Load(declarationResolverMock.Object);

            Assert.NotEmpty(classDeclaration.Extends);

            var baseClassDefinition = classDeclaration.Extends.First().Declaration;

            Assert.NotNull(baseClassDefinition);
            Assert.Equal(baseClassName, baseClassDefinition.Name);
        }
Ejemplo n.º 21
0
        public void LoadCSharpClassTest(string className, string typeParameterName, string baseClassName)
        {
            var location = className.ToBasicPath();
            var csFile   = new CSharpFile(
                location,
                DeclarationHelper.CreateDeclarationFactory(this.testOutputHelper));

            csFile.Load();

            Assert.Single(csFile.Declarations);
            var declaration = csFile.Declarations.Single();

            Assert.Equal(location, declaration.Location);

            var classDecl = Assert.IsType <ClassDeclaration>(declaration);

            classDecl.Load(Mock.Of <IDeclarationResolver>());

            Assert.NotNull(classDecl.GenericParameters);
            Assert.NotNull(classDecl.Extends);

            if (string.IsNullOrEmpty(typeParameterName))
            {
                Assert.Empty(classDecl.GenericParameters);
            }
            else
            {
                var paramDecl = Assert.Single(classDecl.GenericParameters);
                Assert.Equal(typeParameterName, paramDecl.Name);
            }

            if (string.IsNullOrEmpty(baseClassName))
            {
                Assert.Empty(classDecl.Extends);
            }
            else
            {
                var baseClass = Assert.Single(classDecl.Extends);
                Assert.Equal(baseClassName, baseClass.Declaration.Name);
            }
        }
        public void BasicReflectionLoadingTest(Type type)
        {
            var declaration = DeclarationHelper.CreateDeclarationFactory(this.testOutputHelper)
                              .CreateClassDeclaration(type);

            Assert.NotNull(declaration);
            Assert.Equal(
                ReflectionGenericDeclarationLoader <SyntaxNode> .GetNameWithoutGeneric(type.Name),
                declaration.Name);

            Assert.NotNull(declaration.SyntaxNodeProvider);
            Assert.NotNull(declaration.SyntaxNodeProvider.SyntaxNode);

            Assert.Null(declaration.GenericParameters);
            Assert.Null(declaration.Extends);
            Assert.Null(declaration.Members);

            var classDeclaration = Assert.IsType <ClassDeclaration>(declaration);

            var declarationResolverMock = new Mock <IDeclarationResolver>();

            classDeclaration.Load(declarationResolverMock.Object);

            Assert.NotNull(declaration.GenericParameters);
            Assert.NotNull(declaration.Extends);
            Assert.NotNull(declaration.Members);

            if (type.IsGenericTypeDefinition)
            {
                Assert.NotEmpty(declaration.GenericParameters);

                var typeParams = type.GetTypeInfo().GenericTypeParameters;
                Assert.Equal(typeParams.Length, declaration.GenericParameters.Count);

                Assert.Equal(typeParams[0].Name, declaration.GenericParameters.First().Name);
            }
            else
            {
                Assert.Empty(declaration.GenericParameters);
            }
        }
        public void LoadMemberListTest(Type type, bool isArray)
        {
            var declarationFactory     = DeclarationHelper.CreateDeclarationFactory(this.testOutputHelper);
            var declaration            = declarationFactory.CreateClassDeclaration(type);
            var simpleClassDeclaration = declarationFactory.CreateClassDeclaration(typeof(SimpleClass));

            var classDeclaration = Assert.IsType <ClassDeclaration>(declaration);

            var declarationResolverMock = new Mock <IDeclarationResolver>();

            declarationResolverMock.Setup(r => r.Resolve(typeof(SimpleClass))).Returns(simpleClassDeclaration);
            classDeclaration.Load(declarationResolverMock.Object);

            Assert.NotEmpty(classDeclaration.Properties);
            Assert.Equal(2, classDeclaration.Properties.Count);

            var mClass = Assert.Single(declaration.Members.Where(m => m.Name == nameof(ClassWithProperties.PropertyClass)));
            var pClass = Assert.IsType <PropertyDeclaration>(mClass);

            Assert.IsType <GenericDeclarationUse>(pClass.PropertyType);
            Assert.Equal(nameof(SimpleClass), pClass.PropertyType.Declaration.Name);

            var mInt = Assert.Single(declaration.Members.Where(m => m.Name == nameof(ClassWithProperties.PropertyInt)));
            var pInt = Assert.IsType <PropertyDeclaration>(mInt);

            Assert.IsType <PredefinedDeclarationUse>(pInt.PropertyType);
            Assert.Equal("int", pInt.PropertyType.Declaration.Name);

            if (isArray)
            {
                Assert.NotNull(pClass.PropertyType.ArraySpecification);
                Assert.NotNull(pInt.PropertyType.ArraySpecification);
            }
            else
            {
                Assert.Null(pClass.PropertyType.ArraySpecification);
                Assert.Null(pInt.PropertyType.ArraySpecification);
            }
        }
Ejemplo n.º 24
0
        public void LoadGetterSetterPropertyTest()
        {
            var className = nameof(ClassWithGetterSetterProperties);

            var file = className.ToBasicPath();

            var csFile = new CSharpFile(
                file,
                DeclarationHelper.CreateDeclarationFactory(this.testOutputHelper));

            csFile.Load();

            var declaration = Assert.Single(csFile.Declarations);

            var declarationResolver = this.SetupDeclarationResolver(declaration);

            var decl = Assert.IsType <ClassDeclaration>(declaration);

            decl.Load(declarationResolver);

            Assert.NotEmpty(decl.Properties);
            Assert.Equal(3, decl.Properties.Count);

            var rwp = Assert.Single(decl.Properties.Where(p => p.Name == nameof(ClassWithGetterSetterProperties.ReadWriteProperty)));

            Assert.True(rwp.HasGetter);
            Assert.True(rwp.HasSetter);

            var rop = Assert.Single(decl.Properties.Where(p => p.Name == nameof(ClassWithGetterSetterProperties.ReadOnlyProperty)));

            Assert.True(rop.HasGetter);
            Assert.False(rop.HasSetter);

            var wop = Assert.Single(decl.Properties.Where(p => p.Name == nameof(ClassWithGetterSetterProperties.WriteOnlyProperty)));

            Assert.False(wop.HasGetter);
            Assert.True(wop.HasSetter);
        }
Ejemplo n.º 25
0
        public void LoadCSharpProjectTest()
        {
            var projectFile = @"../../../../SoloX.GeneratorTools.Core.CSharp.Sample2/SoloX.GeneratorTools.Core.CSharp.Sample2.csproj";

            var workspaceMock = new Mock <ICSharpWorkspace>();

            workspaceMock
            .Setup(ws => ws.RegisterProject(It.IsAny <string>()))
            .Returns <string>(p => new CSharpProject(p));

            workspaceMock
            .Setup(ws => ws.RegisterFile(It.IsAny <string>()))
            .Returns <string>(p => new CSharpFile(
                                  p,
                                  DeclarationHelper.CreateDeclarationFactory(this.testOutputHelper)));

            var project = new CSharpProject(projectFile);

            project.Load(workspaceMock.Object);

            Assert.Single(project.ProjectReferences);

            var projectReference = project.ProjectReferences.Single();

            Assert.Equal("SoloX.GeneratorTools.Core.CSharp.Sample1.csproj", projectReference.ProjectFile);

            Assert.Single(project.Files);

            var csFile = project.Files.Single();

            Assert.Equal("Sample2Class1.cs", csFile.FileName);

            var ns = project.RootNameSpace;

            Assert.Equal("SoloX.GeneratorTools.Core.CSharp.Sample2", ns);
        }