public void SuccessfullyAddNewProject_When_AllIsCorrect()
        {
            SolutionProject solutionProject = new SolutionProject(this.projectGuid, this.csProjFilePath, this.slnFilePathWithElements, SolutionProjectType.WebProject);

            SolutionFileEditor.AddProject(this.slnFilePathWithElements, solutionProject);

            var slnContents = File.ReadAllText(this.slnFilePathWithElements);

            Assert.IsFalse(string.IsNullOrEmpty(slnContents));

            IEnumerable <SolutionProject> solutionProjects = SolutionFileEditor.GetProjects(this.slnFilePathWithElements);
            bool hasProject = solutionProjects.Any(sp => sp.ProjectGuid == this.projectGuid &&
                                                   sp.AbsolutePath.Equals(this.csProjFilePath, StringComparison.InvariantCultureIgnoreCase) &&
                                                   sp.ProjectType == SolutionProjectType.WebProject);

            Assert.IsTrue(hasProject);
        }
        private IEnumerable <string> GetProjectsPathsFromSolution(string solutionPath, bool onlySitefinityProjects = false)
        {
            if (!solutionPath.EndsWith(Constants.SlnFileExtension, StringComparison.InvariantCultureIgnoreCase))
            {
                throw new Exception(string.Format(Constants.FileIsNotSolutionMessage, solutionPath));
            }

            IEnumerable <string> projectFilesAbsolutePaths = SolutionFileEditor.GetProjects(solutionPath)
                                                             .Select(sp => sp.AbsolutePath)
                                                             .Where(ap => (ap.EndsWith(Constants.CsprojFileExtension, StringComparison.InvariantCultureIgnoreCase) || ap.EndsWith(Constants.VBProjFileExtension, StringComparison.InvariantCultureIgnoreCase)));

            if (onlySitefinityProjects)
            {
                projectFilesAbsolutePaths = projectFilesAbsolutePaths.Where(ap => this.HasSitefinityReferences(ap));
            }

            return(projectFilesAbsolutePaths);
        }