Beispiel #1
0
        public void EnumerateProjects()
        {
            var envDteProject = Substitute.For <Project>();

            envDteProject.Kind.Returns("test project kind");
            var envDteProjects = new List <Project> {
                envDteProject
            };

            envDteUtil.GetSolutionProjects().Returns(envDteProjects);
            var solutionExplorer = solutionExplorerFactory.Create(taskContext, envDteUtil);
            var project          = Substitute.For <ISolutionExplorerProject>();
            var vcProject        = Substitute.For <VCProject>();

            // Project.Object is dynamic. We need to cast it to object so NSubstitute can mock it.
            ((object)envDteProject.Object).Returns(vcProject);
            vcProjectAdapterFactory.Create(vcProject).Returns(project);

            var projects = solutionExplorer.EnumerateProjects();

            Assert.AreEqual(1, projects.Count());
            Assert.AreEqual(project, projects.First());
        }
Beispiel #2
0
        public void GetOutputDirectory()
        {
            var projectPath   = @"C:\GGP_project_path\";
            var projectValues = new ProjectValues
            {
                OutDir = @"C:\GGP_out_dir\",
            };

            var vcProject = CreateVcProject(projectValues, projectPath);
            ISolutionExplorerProject project = vcProjectAdapterFactory.Create(vcProject);

            Assert.AreEqual(RemoveTrailingSeparator(projectValues.OutDir), project.OutputDirectory);
        }