GetProjectPaths() public method

public GetProjectPaths ( string solutionFileName ) : IEnumerable
solutionFileName string
return IEnumerable
Exemplo n.º 1
0
 public void GetProjectPaths_Should_Throw_If_File_Does_Not_Exist()
 {
     var repo = new MockRepository(MockBehavior.Strict);
     Mock<IFileSystem> fileSystem = repo.Create<IFileSystem>();
     fileSystem.Setup(x => x.ReadAllText(@"C:\Dev\Non-Existent\test.sln")).Throws<FileNotFoundException>();
     
     var solutionParser = new SolutionParser(fileSystem.Object);
     solutionParser.GetProjectPaths(@"C:\Dev\Non-Existent\test.sln");
 }
Exemplo n.º 2
0
        public void GetProjectPaths_Should_Return_Correct_Result()
        {
            var repo = new MockRepository(MockBehavior.Strict);
            Mock<IFileSystem> fileSystem = repo.Create<IFileSystem>();
            fileSystem.Setup(x => x.ReadAllText(@"C:\Dev\Solutions\test.sln")).Returns(TestData.SolutionContent);
            
            var solutionParser = new SolutionParser(fileSystem.Object);
            List<string> paths = solutionParser.GetProjectPaths(@"C:\Dev\Solutions\test.sln").ToList();

            Assert.AreEqual(2, paths.Count);
            Assert.AreEqual(@"WebApi\WebApi.csproj", paths[0]);
            Assert.AreEqual(@"..\BusinessLogic\BusinessLogic.csproj", paths[1]);
        }
Exemplo n.º 3
0
        private void SetVersionForSolution(string projectPath, Version defaultVersion, string additionalInfo)
        {
            var helper = new ProjectPathHelper(this.fileSystem);
            var solutionParser = new SolutionParser(this.fileSystem);

            List<string> projectPaths = solutionParser
                .GetProjectPaths(projectPath)
                .Select(x => helper.ResolveProjectRelativePath(projectPath, x))
                .ToList();

            foreach (string path in projectPaths)
            {
                SetVersionForProject(path, defaultVersion, additionalInfo);
            }
        }