Ejemplo n.º 1
0
        public void build_project_with_name(SolutionBuilderContext context, ISolutionContext result, Project project)
        {
            "Given I have a solution builder context"
            ._(() => context = ServiceLocator.Resolve <SolutionBuilderContext>());

            "When I call build"
            ._(() => result = context.CreateBuilder()
                              .WithSolution(item => item.Path = Path.Combine(context.RootDirectory, "Sally.sln"))
                              .WithProject(item => item.Name  = "FrodoFx").Build());

            "It should return the build project"
            ._(() =>
            {
                project = result.Solution.Projects.FirstOrDefault();
                project.Should().NotBeNull();
            });

            "And the project should have a name"
            ._(() => project.Name.Should().Be("FrodoFx"));

            "And the project should have a path"
            ._(() => project.Path.Should().Be(Path.Combine(context.RootDirectory, "FrodoFx", "FrodoFx.csproj")));

            "And the project file should exist on disk"
            ._(() => File.Exists(project.Path).Should().BeTrue());

            "And the solution context path should be the root directory"
            ._(() => result.Path.Should().Be(context.RootDirectory));

            "And it should create a solution file on disk"
            ._(() => File.Exists(Path.Combine(context.RootDirectory, "Sally.sln")).Should().BeTrue())
            .Teardown(() => context.TearDown());
        }
Ejemplo n.º 2
0
        public void PatchSolutionAssemblyInfo(ISolutionContext solutionContext, string version)
        {
            var sourceControlInformation = GetSourceControlInformation(solutionContext);


            foreach (var project in solutionContext.Solution.Projects.Where(p => !p.TestProject && p.AssemblyInfo != null))
            {
                var ver = new Version(version);
                project.AssemblyInfo.Version     = ver;
                project.AssemblyInfo.FileVersion = ver;

                if (sourceControlInformation == null)
                {
                    project.AssemblyInfo.InformationalVersion = ver.ToString();
                }
                else
                {
                    project.AssemblyInfo.InformationalVersion = string.Format("{0} / {1}", ver,
                                                                              sourceControlInformation.LastCommitMessage);
                }


                _assemblyInfoWriter.Patch(project.AssemblyInfo);
            }
        }
        public void Api_can_tell_which_projects_in_a_solution_are_test_projects(CraneRunner craneRunner, RunResult result, CraneTestContext craneTestContext,
                                                                                ISolutionContext solutionContext)
        {
            "Given I have my own private copy of the crane console"
            ._(() => craneTestContext = ServiceLocator.Resolve <CraneTestContext>());

            "And I have a run context"
            ._(() => craneRunner = new CraneRunner());

            "And I have run crane init ServiceStack"
            ._(() => result = craneRunner.Command(craneTestContext.BuildOutputDirectory, "crane init ServiceStack"));

            "When I get the solution context using the api"
            ._(() =>
            {
                var craneApi    = ServiceLocator.Resolve <ICraneApi>();
                solutionContext = craneApi.GetSolutionContext(Path.Combine(craneTestContext.BuildOutputDirectory, "ServiceStack"));
            });

            "It should determine that the ServiceStack project is not a test project"
            ._(() => solutionContext.Solution.Projects.First(p => p.Name == "ServiceStack").TestProject.Should().BeFalse());

            "It should determine that the ServiceStack.UnitTests is a test project"
            ._(() => solutionContext.Solution.Projects.First(p => p.Name == "ServiceStack.UnitTests").TestProject.Should().BeTrue());

            "It should have only the ServiceStack project in the code projects collection"
            ._(() =>
            {
                solutionContext.Solution.CodeProjects.Count().Should().Be(1);
                solutionContext.Solution.CodeProjects.First().Name.Should().Be("ServiceStack");
            }).Teardown(() => craneTestContext.TearDown());
        }
Ejemplo n.º 4
0
        public IEnumerable <RunResult> NugetPack(ISolutionContext solutionContext, string buildOutputPath, string nugetOutputPath, string version)
        {
            var nugetProjects = GetNugetProjects(solutionContext).ToArray();

            var nugetExePath = Path.Combine(solutionContext.Path, "build", "NuGet.exe");

            if (!File.Exists(nugetExePath))
            {
                throw new FileNotFoundException(string.Format("Could not find file {0}.", nugetExePath), nugetExePath);
            }

            foreach (var item in nugetProjects)
            {
                var result = _nuGet.Pack(
                    nugetExePath,
                    item.NugetSpec.Path,
                    nugetOutputPath,
                    new List <Tuple <string, string> >
                {
                    new Tuple <string, string>("version_number", version),
                    new Tuple <string, string>("build_output", _fileManager.GetFullPath(buildOutputPath))
                });

                if (!_nuGet.ValidateResult(result))
                {
                    Debugger.Launch();
                    throw new NuGetException(string.Format("Error executing nuget pack for project {0}.{1}{2}",
                                                           item.Name, Environment.NewLine, result));
                }

                yield return(result);
            }
        }
        public void Api_can_tell_which_projects_have_nuget_specifications(CraneRunner craneRunner, RunResult result, CraneTestContext craneTestContext,
                                                                          ISolutionContext solutionContext)
        {
            "Given I have my own private copy of the crane console"
            ._(() => craneTestContext = ServiceLocator.Resolve <CraneTestContext>());

            "And I have a run context"
            ._(() => craneRunner = new CraneRunner());

            "And I have run crane init ServiceStack"
            ._(() => result = craneRunner.Command(craneTestContext.BuildOutputDirectory, "crane init ServiceStack"));

            "When I get the solution context using the api"
            ._(() =>
            {
                var craneApi    = ServiceLocator.Resolve <ICraneApi>();
                solutionContext = craneApi.GetSolutionContext(Path.Combine(craneTestContext.BuildOutputDirectory, "ServiceStack"));
            });

            "It should determine that the ServiceStack project has a nuGet specification"
            ._(() => solutionContext.Solution.Projects.First(p => p.Name == "ServiceStack").NugetSpec.Should().NotBeNull());

            "It should determine the path of the nuGet specification file"
            ._(() => File.Exists(solutionContext.Solution.Projects.First(p => p.Name == "ServiceStack").NugetSpec.Path).Should().BeTrue());

            "It should determine that the ServiceStack.UnitTests project does not have nuGet specification"
            ._(() => solutionContext.Solution.Projects.First(p => p.Name == "ServiceStack.UnitTests").NugetSpec.Should().BeNull());
        }
Ejemplo n.º 6
0
 public SolutionFactory(ISolutionFileReader solutionFileReader, ICSharpProjectFactory cSharpProjectFactory, ISolutionContext solutionContext, IVisualStudioWriter visualStudioWriter)
 {
     _solutionFileReader   = solutionFileReader;
     _cSharpProjectFactory = cSharpProjectFactory;
     _solutionContext      = solutionContext;
     _visualStudioWriter   = visualStudioWriter;
 }
Ejemplo n.º 7
0
        protected string ProjectCfg(string projectName, IPM pm)
        {
            ISolutionContext context = env.GetSolutionContext(projectName);

            if (pm.It(LevelType.Property, "IsBuildable"))
            {
                if (pm.IsRight(LevelType.RightOperandStd))
                {
                    context.IsBuildable = Value.ToBoolean(pm.FirstLevel.Data);
                    return(Value.Empty);
                }

                if (pm.IsRight(LevelType.RightOperandEmpty))
                {
                    return(Value.From(context.IsBuildable));
                }
            }

            if (pm.It(LevelType.Property, "IsDeployable"))
            {
                if (pm.IsRight(LevelType.RightOperandStd))
                {
                    context.IsDeployable = Value.ToBoolean(pm.FirstLevel.Data);
                    return(Value.Empty);
                }

                if (pm.IsRight(LevelType.RightOperandEmpty))
                {
                    return(Value.From(context.IsDeployable));
                }
            }

            throw new IncorrectNodeException(pm);
        }
        public void Api_returns_null_when_source_control_is_not_being_used(CraneRunner craneRunner, RunResult result, CraneTestContext craneTestContext,
                                                                           ISolutionContext solutionContext, ISourceControlInformation sourceControlInformation,
                                                                           ICraneApi craneApi)
        {
            "Given I have my own private copy of the crane console"
            ._(() => craneTestContext = ServiceLocator.Resolve <CraneTestContext>());

            "And I have a run context"
            ._(() => craneRunner = new CraneRunner());

            "And I have run crane init ServiceStack"
            ._(() => result = craneRunner.Command(craneTestContext.BuildOutputDirectory, "crane init ServiceStack"));

            "And I have the solution context using the api"
            ._(() =>
            {
                craneApi        = ServiceLocator.Resolve <ICraneApi>();
                solutionContext = craneApi.GetSolutionContext(Path.Combine(craneTestContext.BuildOutputDirectory, "ServiceStack"));
            });

            "When I get the source information using the api"
            ._(() => sourceControlInformation = craneApi.GetSourceControlInformation(solutionContext));

            "It should return null as the source control information"
            ._(() => sourceControlInformation.Should().BeNull())
            .Teardown(() => craneTestContext.TearDown());
        }
Ejemplo n.º 9
0
        public void patch_solution_assembly_info(ICraneApi craneApi,
                                                 SolutionBuilderContext context, ISolutionContext solutionContext, Project project,
                                                 AssemblyInfo updatedInfo, string updatedRawInfo)
        {
            "Given I have a crane api"
            ._(() => craneApi = ServiceLocator.Resolve <CraneApi>());

            "And I have a solution builder context"
            ._(() => context = ServiceLocator.Resolve <SolutionBuilderContext>());

            "And I have a solution with two projects"
            ._(() => context.CreateBuilder()
               .WithSolution(item => item.Path = Path.Combine(context.RootDirectory, "Sally.sln"))
               .WithProject(item => item.Name  = "FrodoFx")
               .WithFile <AssemblyInfo>(item =>
            {
                item.Title                = "Sally";
                item.Description          = "Next generation web server";
                item.Version              = new Version(0, 0, 0, 1);
                item.FileVersion          = new Version(0, 0, 0, 2);
                item.InformationalVersion = "RELEASE";
            })
               .WithProject(item => item.Name = "BobFx")
               .WithFile <AssemblyInfo>(item =>
            {
                item.Title                = "Bob";
                item.Description          = "Old school";
                item.Version              = new Version(0, 0, 0, 1);
                item.FileVersion          = new Version(0, 0, 0, 2);
                item.InformationalVersion = "RELEASE";
            }).Build());

            "And I have got the solution context"
            ._(() => solutionContext = craneApi.GetSolutionContext(context.RootDirectory));

            "When I path the solution assembly info for all projects"
            ._(() => craneApi.PatchSolutionAssemblyInfo(solutionContext, "1.2.3.4"));

            "Then file version should be set to 1.2.3.4 in all assembly info files"
            ._(() =>
            {
                solutionContext = craneApi.GetSolutionContext(context.RootDirectory);
                solutionContext.Solution.Projects.All(p => p.AssemblyInfo.FileVersion.ToString() == "1.2.3.4")
                .Should()
                .BeTrue();
            });

            "Then version should be set to 1.2.3.4 in all assembly info files"
            ._(() => solutionContext.Solution.Projects.All(p => p.AssemblyInfo.Version.ToString() == "1.2.3.4")
               .Should()
               .BeTrue());

            "Then file informational version should be set to 1.2.3.4"
            ._(() => solutionContext.Solution.Projects.All(p => p.AssemblyInfo.InformationalVersion.ToString() == "1.2.3.4")
               .Should()
               .BeTrue()
               ).Teardown(() => context.TearDown());
        }
Ejemplo n.º 10
0
 public SolutionBuilder(ISolutionContext solutionContext, ISolutionFactory solutionFactory, IFileFactory fileFactory)
 {
     _solutionContext = solutionContext;
     _solutionFactory = solutionFactory;
     _fileFactory     = fileFactory;
     _projects        = new List <Project>();
     _plainFiles      = new List <PlainFile>();
     _solution        = new Solution();
 }
Ejemplo n.º 11
0
        public void can_publish_build_to_nuget(CraneRunner craneRunner, RunResult result, CraneTestContext craneTestContext,
                                               ISolutionContext solutionContext, string projectDir, ICraneApi craneApi, NuGetServerContext nuGetServer)
        {
            "Given I have my own private copy of the crane console"
            ._(() => craneTestContext = ServiceLocator.Resolve <CraneTestContext>());

            "And I have a nuGet server running"
            ._(() =>
            {
                nuGetServer = new NuGetServerContext(craneTestContext);
                nuGetServer.PackageCount.Should().BeGreaterThan(-1);
            });

            "And I have a run context"
            ._(() => craneRunner = new CraneRunner());

            "And I have run crane init ServiceStack"
            ._(() => result = craneRunner.Command(craneTestContext.BuildOutputDirectory, "crane init ServiceStack"));

            "And I have build the project"
            ._(() =>
            {
                result = new BuildScriptRunner().Run(Path.Combine(craneTestContext.BuildOutputDirectory, "ServiceStack"));
                result.Should().BeBuiltSuccessfulyWithAllTestsPassing().And.BeErrorFree();;
            });

            "And I have the solution context using the api"
            ._(() =>
            {
                projectDir      = Path.Combine(craneTestContext.BuildOutputDirectory, "ServiceStack");
                craneApi        = ServiceLocator.Resolve <ICraneApi>();
                solutionContext = craneApi.GetSolutionContext(projectDir);
            });

            "And I have packaged the nuget spec"
            ._(() =>
            {
                var buildOutputPath = Path.Combine(solutionContext.Path, "build-output");
                craneApi.NugetPack(solutionContext, buildOutputPath, Path.Combine(buildOutputPath, "nuGet"), "0.0.0.0").First().Should().BeErrorFree();
            });

            "When I publish to nuGet using the api"
            ._(
                () =>
                craneApi.NugetPublish(solutionContext,
                                      Path.Combine(solutionContext.Path, "build-output", "nuGet"), "0.0.0.0",
                                      nuGetServer.Source.ToString(), nuGetServer.ApiKey).First().Should().BeErrorFree());

            "It should push the package to the nuGet server"
            ._(() => nuGetServer.PackageExists("ServiceStack", "0.0.0.0").Should().BeTrue())
            .Teardown(() =>
            {
                nuGetServer.TearDown();
                craneTestContext.TearDown();
            });
        }
Ejemplo n.º 12
0
 public void ResolveFrom(IReferencingProject referencingProject, ISolutionContext solution)
 {
     foreach (var projectId in _referencedProjectsIds)
     {
         try
         {
             solution.ResolveReferenceFrom(referencingProject, projectId);
         }
         catch (ReferencedProjectNotFoundInSolutionException e)
         {
             _support.Report(e);
         }
     }
 }
Ejemplo n.º 13
0
        public void can_create_a_nuget_package(
            CraneRunner craneRunner,
            RunResult result,
            CraneTestContext craneTestContext,
            ISolutionContext solutionContext,
            string projectDir,
            ICraneApi craneApi,
            string buildOutputFolder,
            string nugetOutputFolder,
            IEnumerable <RunResult> runResults)
        {
            "Given I have my own private copy of the crane console"
            ._(() => craneTestContext = ServiceLocator.Resolve <CraneTestContext>());

            "And I have a run context"
            ._(() => craneRunner = new CraneRunner());

            "And I have run crane init ServiceStack"
            ._(() => result = craneRunner.Command(craneTestContext.BuildOutputDirectory, "crane init ServiceStack"));

            "And I have build the project"
            ._(() =>
            {
                result = new BuildScriptRunner().Run(Path.Combine(craneTestContext.BuildOutputDirectory, "ServiceStack"));
                result.Should().BeBuiltSuccessfulyWithAllTestsPassing().And.BeErrorFree();;
            });

            "And I have the solution context using the api"
            ._(() =>
            {
                projectDir        = Path.Combine(craneTestContext.BuildOutputDirectory, "ServiceStack");
                craneApi          = ServiceLocator.Resolve <ICraneApi>();
                solutionContext   = craneApi.GetSolutionContext(projectDir);
                buildOutputFolder = Path.Combine(solutionContext.Path, "build-output");
            });

            "When I create nuGet packages using the api"
            ._(
                () =>
            {
                nugetOutputFolder = Path.Combine(buildOutputFolder, "nuGet");
                runResults        = craneApi.NugetPack(solutionContext, buildOutputFolder, nugetOutputFolder, "0.0.0.0");
                runResults.ForEach(item => _log.Debug(result));
            });

            "It should create nuGet packages for all the projects in the built solution"
            ._(() => File.Exists(Path.Combine(nugetOutputFolder, "ServiceStack.0.0.0.0.nupkg")).Should().BeTrue("could not find nuget file {0}, it should have been created.", Path.Combine(nugetOutputFolder, "ServiceStack.0.0.0.0.nupkg")))
            .Teardown(() => craneTestContext.TearDown());
        }
Ejemplo n.º 14
0
 DependencyAnalyzer(
     IActivityMonitor m,
     IReadOnlyCollection <ISolution> solutions,
     ISolutionContext solutionCtx,
     ProjectItem.Cache projects,
     List <PackageReference> externalRefs,
     bool traceGraphDetails)
 {
     _solutions                = solutions;
     _solutionContext          = solutionCtx;
     _version                  = _solutionContext?.Version ?? 0;
     _projects                 = projects;
     _externalRefs             = externalRefs;
     _defaultDependencyContext = CreateDependencyContext(m, traceGraphDetails);
 }
Ejemplo n.º 15
0
        public void build_project_with_assembly_info(SolutionBuilderContext context, ISolutionContext result, Project project, AssemblyInfo assemblyInfo)
        {
            "Given I have a solution builder context"
            ._(() => context = ServiceLocator.Resolve <SolutionBuilderContext>());

            "When I call build with a solution, a project and an assembly info"
            ._(() => result = context.CreateBuilder()
                              .WithSolution(item => item.Path = Path.Combine(context.RootDirectory, "Sally.sln"))
                              .WithProject(item => item.Name  = "FrodoFx")
                              .WithFile <AssemblyInfo>(item =>
            {
                item.Title                = "FrodoFx";
                item.Description          = "Middle earth web server";
                item.FileVersion          = new Version(0, 0, 1, 2049);
                item.Version              = new Version(0, 0, 1);
                item.InformationalVersion = "release";
            })
                              .Build());

            "It should return the build project with an assembly info"
            ._(() =>
            {
                project = result.Solution.Projects.FirstOrDefault();
                project.Should().NotBeNull("the project should not be null");
                assemblyInfo = project.AssemblyInfo;
                assemblyInfo.Should().NotBeNull("the assembly info should not be null");
            });

            "And the assembly info title should be set"
            ._(() => assemblyInfo.Title.Should().Be("FrodoFx"));

            "And the assembly info version should be set"
            ._(() => assemblyInfo.Version.Should().Be(new Version(0, 0, 1)));

            "And the assembly info file version should be set"
            ._(() => assemblyInfo.FileVersion.Should().Be(new Version(0, 0, 1, 2049)));

            "And the assembly informational attribute should be set"
            ._(() => assemblyInfo.InformationalVersion.Should().Be("release"));

            "And the assembly info file should exist on disk"
            ._(() => File.Exists(assemblyInfo.Path).Should().BeTrue(string.Format("assembly info with path: {0} did not exist on disk", assemblyInfo.Path)));

            "And it should create a solution file on disk"
            ._(() => File.Exists(Path.Combine(context.RootDirectory, "Sally.sln")).Should().BeTrue())
            .Teardown(() => context.TearDown());
        }
        public void Api_can_read_the_latest_git_commit_from_a_solution_in_git(CraneRunner craneRunner, RunResult result, CraneTestContext craneTestContext,
                                                                              ISolutionContext solutionContext, string projectDir, Git git, ISourceControlInformation sourceControlInformation,
                                                                              ICraneApi craneApi)
        {
            "Given I have my own private copy of the crane console"
            ._(() => craneTestContext = ServiceLocator.Resolve <CraneTestContext>());

            "And I have a run context"
            ._(() => craneRunner = new CraneRunner());

            "And I have run crane init ServiceStack"
            ._(() => result = craneRunner.Command(craneTestContext.BuildOutputDirectory, "crane init ServiceStack"));

            "And I initialize that as a git repository"
            ._(() =>
            {
                projectDir = Path.Combine(craneTestContext.BuildOutputDirectory, "ServiceStack");
                git        = ServiceLocator.Resolve <Git>();
                git.Run("init", projectDir).ErrorOutput.Should().BeEmpty();
                git.Run("config user.email [email protected]", projectDir).ErrorOutput.Should().BeEmpty();
            });

            "And I have a previous commit"
            ._(() =>
            {
                git.Run("add -A", projectDir).ErrorOutput.Should().BeEmpty();
                git.Run("config user.email [email protected]", projectDir).ErrorOutput.Should().BeEmpty();
                git.Run("commit -m \"First commit of ServiceStack\"", projectDir).ErrorOutput.Should().BeEmpty();
            });


            "And I have the solution context using the api"
            ._(() =>
            {
                craneApi        = ServiceLocator.Resolve <ICraneApi>();
                solutionContext = craneApi.GetSolutionContext(projectDir);
            });
            "When I get the source information using the api"
            ._(() => sourceControlInformation = craneApi.GetSourceControlInformation(solutionContext));

            "It should set the provider name to git"
            ._(() => sourceControlInformation.ProviderName.Should().Be("git"));

            "It should return the latest commit message as 'First commit of ServiceStack'"
            ._(() => sourceControlInformation.LastCommitMessage.Should().Contain("First commit of ServiceStack"))
            .Teardown(() => craneTestContext.TearDown());
        }
Ejemplo n.º 17
0
        private void InitializeSolutionContext(DTE dte)
        {
            try
            {
                _solutionContext = ServiceLocator.Kernel.Get <ISolutionContext>();

                if (null == dte.Solution)
                {
                    _log.Error("Failed to load Solution object from DTE");
                }
                else if (string.IsNullOrEmpty(dte.Solution.FileName))
                {
                    _log.Warn("dte.Solution.FileName is null or empty");
                }
                else
                {
                    _solutionContext.SolutionFileName = new FilePath(dte.Solution.FileName);

                    _log.InfoFormat("Set Solution Context to [{0}]", dte.Solution.FileName);
                }

                _visualStudioEventProxy.OnSolutionOpening += (o, e) =>
                {
                    if (string.IsNullOrEmpty(dte.Solution.FileName))
                    {
                        _log.Warn("dte.Solution.FileName is null or empty");
                    }
                    else
                    {
                        _solutionContext.SolutionFileName = new FilePath(dte.Solution.FileName);

                        _log.InfoFormat("Set Solution Context to [{0}]", dte.Solution.FileName);
                    }
                };
            }
            catch (Exception e)
            {
                _log.Fatal("Exception initializing Solution Context", e);

                throw;
            }
        }
        public ISourceControlInformation ReadSourceControlInformation(ISolutionContext solutionContext)
        {
            try
            {
                var git    = new Git();
                var result = git.Run("log --oneline -1", solutionContext.Path);

                if (result.ExitCode != 0)
                {
                    return(null);
                }

                var message = result.StandardOutput;

                return(new GitSourceControlInformation(message));
            }
            catch
            {
                return(null);
            }
        }
        public void Api_can_read_a_solution_by_path_direct_to_sln_file(CraneRunner craneRunner, RunResult result, CraneTestContext craneTestContext,
                                                                       ISolutionContext solutionContext)
        {
            "Given I have my own private copy of the crane console"
            ._(() => craneTestContext = ServiceLocator.Resolve <CraneTestContext>());

            "And I have a run context"
            ._(() => craneRunner = new CraneRunner());

            "And I have run crane init ServiceStack"
            ._(() => result = craneRunner.Command(craneTestContext.BuildOutputDirectory, "crane init ServiceStack"));

            "When I get the solution context using the api"
            ._(() =>
            {
                var craneApi    = ServiceLocator.Resolve <ICraneApi>();
                solutionContext = craneApi.GetSolutionContext(Path.Combine(craneTestContext.BuildOutputDirectory, "ServiceStack", "src", "ServiceStack.sln"));
            });

            "It should have the correct path to the solution"
            ._(() => solutionContext.Solution.Path.Should()
               .Be(Path.Combine(craneTestContext.BuildOutputDirectory, "ServiceStack", "src",
                                "ServiceStack.sln")));

            "It should set the solution context path to the root folder"
            ._(() => solutionContext.Path.Should().Be(Path.Combine(craneTestContext.BuildOutputDirectory, "ServiceStack")));

            "It should have 2 projects"
            ._(() => solutionContext.Solution.Projects.Count().Should().Be(2));

            "It should have one project called ServiceStack"
            ._(() => solutionContext.Solution.Projects.Count(p => p.Name == "ServiceStack").Should().Be(1));

            "It should have one project called ServiceStack.UnitTests"
            ._(() => solutionContext.Solution.Projects.Count(p => p.Name == "ServiceStack.UnitTests").Should().Be(1))
            .Teardown(() => craneTestContext.TearDown());
        }
Ejemplo n.º 20
0
        public IEnumerable <RunResult> NugetPublish(ISolutionContext solutionContext, string nugetOutputPath, string version, string source, string apiKey)
        {
            var nugetProjects = GetNugetProjects(solutionContext).ToArray();
            var results       = new List <RunResult>(nugetProjects.Length);

            nugetProjects.ForEach(
                item =>
            {
                var result = _nuGet.Publish(
                    Path.Combine(solutionContext.Path, "build", "NuGet.exe"),
                    Path.Combine(nugetOutputPath,
                                 string.Format("{0}.{1}.nupkg", item.Name, version)),
                    source, apiKey);
                results.Add(result);

                if (!_nuGet.ValidateResult(result))
                {
                    throw new NuGetException(string.Format("Error executing nuget push for project {0}.{1}{2}",
                                                           item.Name, Environment.NewLine, result));
                }
            });

            return(results);
        }
Ejemplo n.º 21
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="m"></param>
        /// <param name="solutions"></param>
        /// <param name="traceGraphDetails"></param>
        /// <param name="solutionCtx">May be null, used to construct the <see cref="DependencyAnalyzer"/></param>
        /// <returns></returns>
        internal static DependencyAnalyzer Create(IActivityMonitor m, IReadOnlyCollection <ISolution> solutions, bool traceGraphDetails, ISolutionContext solutionCtx)
        {
            var packages     = new Dictionary <Artifact, LocalPackageItem>();
            var projectItems = new ProjectItem.Cache();
            var externalRefs = new List <PackageReference>();

            // Note: Project to project references are translated into Requirements directly
            //       in the ProjectItem constructor.
            //       After having built the ProjectItem, we handle here the Packages (and PackageReferences between
            //       projects).
            using (m.OpenDebug("Creating all the ProjectItem for all projects in all solutions."))
            {
                foreach (var s in solutions)
                {
                    using (m.OpenDebug($"Solution {s.Name}."))
                    {
                        foreach (var project in s.Projects)
                        {
                            projectItems.Create(project);
                        }
                    }
                }
            }
            using (m.OpenDebug("Creating Package for all installable Artifacts in all solutions."))
            {
                foreach (var s in solutions)
                {
                    using (m.OpenDebug($"Solution {s.Name}."))
                    {
                        foreach (var project in s.Projects)
                        {
                            foreach (var package in project.GeneratedArtifacts.Where(a => a.Artifact.Type.IsInstallable))
                            {
                                if (packages.TryGetValue(package.Artifact, out var alreadyPublished))
                                {
                                    m.Error($"'{package.Project.Solution+"->"+package}' is already published by {alreadyPublished.Project.Solution+"->"+alreadyPublished.Project}.");
                                    return(null);
                                }
                                packages.Add(package.Artifact, new LocalPackageItem(package.Artifact, project));
                                m.Debug($"Package '{package}' created.");
                            }
                        }
                    }
                }
            }

            // 3 - Create the requirements between each project and Packages that are bound to a
            //     Published project (the LocalPackageItem previuosly created).
            //     When PackageReferences references external Packages, we add it to the ExternalRefs.
            foreach (var project in projectItems.AllProjectItems)
            {
                // Consider package references (Project to Project references are handled by ProjectItem constructors).
                foreach (var dep in project.Project.PackageReferences)
                {
                    if (packages.TryGetValue(dep.Target.Artifact, out LocalPackageItem target))
                    {
                        if (target.Project.Solution != project.Project.Solution)
                        {
                            project.AddRequires(target);
                        }
                        else
                        {
                            // A project is referencing a Package that is generated by
                            // its own Solution. This can happen (even if it is strange): for instance to test packages
                            // from the solution itself (the more correct way to do this is to use another
                            // Repository/Solution to test the packages since here you always test the "previous"
                            // package version).
                            //
                            // We transform the package reference into a project reference so that this edge
                            // case does not create cycles.
                            project.AddRequires(projectItems[target.Project]);
                        }
                    }
                    else
                    {
                        // Dependency to an external Package.
                        externalRefs.Add(dep);
                    }
                }
            }
            return(new DependencyAnalyzer(
                       m,
                       solutions,
                       solutionCtx,
                       projectItems,
                       externalRefs,
                       traceGraphDetails));
        }
Ejemplo n.º 22
0
        private void WireUpVisualStudioEvents(IVisualStudioEventProxy visualStudioEventProxy,
                                              ICodeGeneratorDependencyManager codeGeneratorDependencyManager, ISolutionContext solutionContext)
        {
            visualStudioEventProxy.OnSolutionClosing +=
                (sender, args) =>
            {
                _log.Info("Solution closing.  Firing OnClearCache");
                OnClearCache(this, new EventArgs());
            };

            visualStudioEventProxy.OnProjectAdded +=
                (sender, args) =>
            {
                _log.InfoFormat("OnProjectAdded - Evict [{0}]", solutionContext.SolutionFileName);

                OnEvictFromCache(this, new EvictFromCacheEventArgs(solutionContext.SolutionFileName));
            };

            visualStudioEventProxy.OnProjectRemoved +=
                (sender, args) =>
            {
                _log.InfoFormat("OnProjectRemoved - Evict [{0}]", args.ProjectFullPath);

                OnEvictFromCache(this, new EvictFromCacheEventArgs(args.ProjectFullPath));

                _log.InfoFormat("OnProjectRemoved - Evict [{0}]", solutionContext.SolutionFileName);

                OnEvictFromCache(this, new EvictFromCacheEventArgs(solutionContext.SolutionFileName));
            };

            visualStudioEventProxy.OnProjectReferenceAdded +=
                (sender, args) =>
            {
                _log.InfoFormat("OnProjectReferenceAdded - Evict [{0}]", args.ProjectFullPath);

                OnEvictFromCache(this, new EvictFromCacheEventArgs(args.ProjectFullPath));

                //TODO - Evict Project Items - Compilation needs to be updated?
            };

            visualStudioEventProxy.OnProjectReferenceRemoved +=
                (sender, args) =>
            {
                _log.InfoFormat("OnProjectReferenceRemoved - Evict [{0}]", args.ProjectFullPath);

                OnEvictFromCache(this, new EvictFromCacheEventArgs(args.ProjectFullPath));

                //TODO - Evict Project Items - Compilation needs to be updated?
            };

            visualStudioEventProxy.OnProjectItemSaved +=
                (sender, args) =>
            {
                _log.InfoFormat("OnProjectItemSaved - Evict [{0}]", args.ClassFullPath);

                OnEvictFromCache(this, new EvictFromCacheEventArgs(args.ClassFullPath));

                codeGeneratorDependencyManager
                .GetFilesThatDependOn(args.ClassFullPath)
                .Map(f =>
                {
                    _log.InfoFormat("OnProjectItemSaved - Evict Dependency [{0}]", f.FileName);

                    OnEvictFromCache(this, new EvictFromCacheEventArgs(f.FileName)
                    {
                        FileOnDiskHasChanged = false
                    });
                });
            };

            visualStudioEventProxy.OnProjectItemRemoved +=
                (sender, args) =>
            {
                _log.InfoFormat("OnProjectItemRemoved - Evict [{0}]", args.ClassFullPath);

                OnEvictFromCache(this, new EvictFromCacheEventArgs(args.ClassFullPath));
            };

            visualStudioEventProxy.OnProjectItemRenamed +=
                (sender, args) =>
            {
                _log.InfoFormat("OnProjectItemRemoved - Evict [{0}]", args.OldClassFileName);

                OnEvictFromCache(this, new EvictFromCacheEventArgs(args.OldClassFileName));
            };
        }
Ejemplo n.º 23
0
        public void Get_context_with_root_folder_path_returns_all_projects(ICraneApi craneApi, SolutionBuilderContext context, ISolutionContext result, Project project)
        {
            "Given I have a crane api"
            ._(() => craneApi = ServiceLocator.Resolve <CraneApi>());

            "And I have a solution builder context"
            ._(() => context = ServiceLocator.Resolve <SolutionBuilderContext>());

            "And I have a solution with two projects"
            ._(() => context.CreateBuilder()
               .WithSolution(item => item.Path = Path.Combine(context.RootDirectory, "Sally.sln"))
               .WithProject(item => item.Name  = "FrodoFx")
               .WithProject(item => item.Name  = "FrodoFx.UnitTests")
               .Build());

            "When I get the solution context via the api"
            ._(() =>
            {
                result = craneApi.GetSolutionContext(context.RootDirectory);
            });

            "And it should return a model representation of the solution on disk"
            ._(() => result.Solution.Should().NotBeNull());

            "And it should have the correct solution name"
            ._(() => result.Solution.Name.Should().Be("Sally"));

            "And it should have the correct solution path"
            ._(() => result.Solution.Path.Should().Be(Path.Combine(context.RootDirectory, "Sally.sln")));

            "And it should reference its parent context"
            ._(() => result.Solution.SolutionContext.Should().NotBeNull());

            "And it should have two projects"
            ._(() => result.Solution.Projects.Count().Should().Be(2));

            "And the projects should have the correct name"
            ._(() =>
            {
                result.Solution.Projects.Any(item => item.Name.Equals("FrodoFx")).Should().BeTrue();
                result.Solution.Projects.Any(item => item.Name.Equals("FrodoFx.UnitTests")).Should().BeTrue();
            });

            "And the projects should have the correct path"
            ._(() =>
            {
                result.Solution.Projects.Any(item => item.Path.Equals(Path.Combine(context.RootDirectory, "FrodoFx", "FrodoFx.csproj"))).Should().BeTrue();
                result.Solution.Projects.Any(item => item.Path.Equals(Path.Combine(context.RootDirectory, "FrodoFx.UnitTests", "FrodoFx.UnitTests.csproj"))).Should().BeTrue();
            });

            "And the projects should reference their solution"
            ._(() => result.Solution.Projects.All(item => item.Solution != null).Should().BeTrue())
            .Teardown(() => context.TearDown());
        }
 public void ResolveReferencesFrom(ISolutionContext solution)
 {
     _referencedProjects.ResolveFrom(this, solution);
 }
Ejemplo n.º 25
0
        public CacheEventHelper(IVisualStudioEventProxy visualStudioEventProxy, ICodeGeneratorDependencyManager codeGeneratorDependencyManager, ISolutionContext solutionContext)
        {
            AddEmptyEventHandlers();

            WireUpVisualStudioEvents(visualStudioEventProxy, codeGeneratorDependencyManager, solutionContext);
        }
Ejemplo n.º 26
0
        private void WireUpVisualStudioEvents(IVisualStudioEventProxy visualStudioEventProxy,
            ICodeGeneratorDependencyManager codeGeneratorDependencyManager, ISolutionContext solutionContext)
        {
            visualStudioEventProxy.OnSolutionClosing +=
                (sender, args) =>
                {
                    _log.Info("Solution closing.  Firing OnClearCache");
                    OnClearCache(this, new EventArgs());
                };

            visualStudioEventProxy.OnProjectAdded +=
                (sender, args) =>
                {
                    _log.InfoFormat("OnProjectAdded - Evict [{0}]", solutionContext.SolutionFileName);

                    OnEvictFromCache(this, new EvictFromCacheEventArgs(solutionContext.SolutionFileName));
                };

            visualStudioEventProxy.OnProjectRemoved +=
                (sender, args) =>
                {
                    _log.InfoFormat("OnProjectRemoved - Evict [{0}]", args.ProjectFullPath);

                    OnEvictFromCache(this, new EvictFromCacheEventArgs(args.ProjectFullPath));

                    _log.InfoFormat("OnProjectRemoved - Evict [{0}]", solutionContext.SolutionFileName);

                    OnEvictFromCache(this, new EvictFromCacheEventArgs(solutionContext.SolutionFileName));
                };

            visualStudioEventProxy.OnProjectReferenceAdded +=
                (sender, args) =>
                {
                    _log.InfoFormat("OnProjectReferenceAdded - Evict [{0}]", args.ProjectFullPath);

                    OnEvictFromCache(this, new EvictFromCacheEventArgs(args.ProjectFullPath));

                    //TODO - Evict Project Items - Compilation needs to be updated?
                };

            visualStudioEventProxy.OnProjectReferenceRemoved +=
                (sender, args) =>
                {
                    _log.InfoFormat("OnProjectReferenceRemoved - Evict [{0}]", args.ProjectFullPath);

                    OnEvictFromCache(this, new EvictFromCacheEventArgs(args.ProjectFullPath));

                    //TODO - Evict Project Items - Compilation needs to be updated?
                };

            visualStudioEventProxy.OnProjectItemSaved +=
                (sender, args) =>
                {
                    _log.InfoFormat("OnProjectItemSaved - Evict [{0}]", args.ClassFullPath);

                    OnEvictFromCache(this, new EvictFromCacheEventArgs(args.ClassFullPath));

                    codeGeneratorDependencyManager
                        .GetFilesThatDependOn(args.ClassFullPath)
                        .Map(f =>
                        {
                            _log.InfoFormat("OnProjectItemSaved - Evict Dependency [{0}]", f.FileName);

                            OnEvictFromCache(this, new EvictFromCacheEventArgs(f.FileName)
                            {
                                FileOnDiskHasChanged = false
                            });
                        });
                };

            visualStudioEventProxy.OnProjectItemRemoved +=
                (sender, args) =>
                {
                    _log.InfoFormat("OnProjectItemRemoved - Evict [{0}]", args.ClassFullPath);

                    OnEvictFromCache(this, new EvictFromCacheEventArgs(args.ClassFullPath));
                };

            visualStudioEventProxy.OnProjectItemRenamed +=
                (sender, args) =>
                {
                    _log.InfoFormat("OnProjectItemRemoved - Evict [{0}]", args.OldClassFileName);

                    OnEvictFromCache(this, new EvictFromCacheEventArgs(args.OldClassFileName));
                };
        }
Ejemplo n.º 27
0
 private static IEnumerable <Project> GetNugetProjects(ISolutionContext solutionContext)
 {
     return(solutionContext.Solution.Projects
            .Where(p => p.NugetSpec != null));
 }
Ejemplo n.º 28
0
        public void patch_solution_assembly_info_when_project_in_git(ICraneApi craneApi,
                                                                     SolutionBuilderContext context, ISolutionContext solutionContext, Project project,
                                                                     AssemblyInfo updatedInfo, string updatedRawInfo, Git git)
        {
            "Given I have a crane api"
            ._(() => craneApi = ServiceLocator.Resolve <CraneApi>());

            "And I have a solution builder context"
            ._(() => context = ServiceLocator.Resolve <SolutionBuilderContext>());

            "And I have a solution with two projects"
            ._(() => context.CreateBuilder()
               .WithSolution(item => item.Path = Path.Combine(context.RootDirectory, "Sally.sln"))
               .WithProject(item => item.Name  = "FrodoFx")
               .WithFile <AssemblyInfo>(item =>
            {
                item.Title                = "Sally";
                item.Description          = "Next generation web server";
                item.Version              = new Version(0, 0, 0, 1);
                item.FileVersion          = new Version(0, 0, 0, 2);
                item.InformationalVersion = "RELEASE";
            })
               .WithProject(item => item.Name = "BobFx")
               .WithFile <AssemblyInfo>(item =>
            {
                item.Title                = "Bob";
                item.Description          = "Old school";
                item.Version              = new Version(0, 0, 0, 1);
                item.FileVersion          = new Version(0, 0, 0, 2);
                item.InformationalVersion = "RELEASE";
            }).Build());

            "And I have got the solution context"
            ._(() => solutionContext = craneApi.GetSolutionContext(context.RootDirectory));

            "And I initialize that as a git repository"
            ._(() =>
            {
                git = ServiceLocator.Resolve <Git>();
                git.Run("init", context.RootDirectory).ErrorOutput.Should().BeEmpty();
                git.Run("config user.email [email protected]", context.RootDirectory).ErrorOutput.Should().BeEmpty();
            });

            "And I have a previous commit"
            ._(() =>
            {
                git.Run("add -A", context.RootDirectory).ErrorOutput.Should().BeEmpty();
                git.Run("config user.email [email protected]", context.RootDirectory).ErrorOutput.Should().BeEmpty();
                git.Run("commit -m \"My brand new project\"", context.RootDirectory).ErrorOutput.Should().BeEmpty();
            });

            "When I path the solution assembly info for all projects"
            ._(() => craneApi.PatchSolutionAssemblyInfo(solutionContext, "1.2.3.4"));

            "Then file version should be set to 1.2.3.4 in all assembly info files"
            ._(() =>
            {
                solutionContext = craneApi.GetSolutionContext(context.RootDirectory);
                solutionContext.Solution.Projects.All(p => p.AssemblyInfo.FileVersion.ToString() == "1.2.3.4")
                .Should()
                .BeTrue();
            });

            "Then version should be set to 1.2.3.4 in all assembly info files"
            ._(() => solutionContext.Solution.Projects.All(p => p.AssemblyInfo.Version.ToString() == "1.2.3.4")
               .Should()
               .BeTrue());

            "Then file informational version should start with 1.2.3.4"
            ._(() => solutionContext.Solution.Projects.All(p => p.AssemblyInfo.InformationalVersion.ToString().StartsWith("1.2.3.4"))
               .Should()
               .BeTrue())
            .Teardown(() => context.TearDown());

            "Then file informational version should end with the commit message 'My brand new project'"
            ._(() => solutionContext.Solution.Projects.All(p => p.AssemblyInfo.InformationalVersion.ToString().EndsWith("My brand new project"))
               .Should()
               .BeTrue())
            .Teardown(() => context.TearDown());
        }
Ejemplo n.º 29
0
 public ISourceControlInformation GetSourceControlInformation(ISolutionContext solutionContext)
 {
     return(_sourceControlInformationReader.ReadSourceControlInformation(solutionContext));
 }
Ejemplo n.º 30
0
        public void patch_assembly_info(ICraneApi craneApi,
                                        SolutionBuilderContext context, ISolutionContext solutionContext, Project project, AssemblyInfo updatedInfo, string updatedRawInfo)
        {
            "Given I have a crane api"
            ._(() => craneApi = ServiceLocator.Resolve <CraneApi>());

            "And I have a solution builder context"
            ._(() => context = ServiceLocator.Resolve <SolutionBuilderContext>());

            "And I have a solution with a project and an assembly info file"
            ._(() => solutionContext = context.CreateBuilder()
                                       .WithSolution(item => item.Path = Path.Combine(context.RootDirectory, "Sally.sln"))
                                       .WithProject(item => item.Name  = "FrodoFx")
                                       .WithFile <AssemblyInfo>(item =>
            {
                item.Title                = "Sally";
                item.Description          = "Next generation web server";
                item.Version              = new Version(0, 0, 0, 1);
                item.FileVersion          = new Version(0, 0, 0, 2);
                item.InformationalVersion = "RELEASE";
            }).Build());

            "And I have an updated assembly info with different version, file number and informational attribute"
            ._(() =>
            {
                updatedInfo                      = solutionContext.Solution.Projects.First().AssemblyInfo;
                updatedInfo.Version              = new Version(0, 1, 0, 0);
                updatedInfo.FileVersion          = new Version(0, 1, 20);
                updatedInfo.InformationalVersion = "DEBUG";
            });

            "When I patch the assemble info"
            ._(() =>
            {
                craneApi.PatchAssemblyInfo(updatedInfo);

                solutionContext = craneApi.GetSolutionContext(solutionContext.Path);     // reload to get updated model
                project         = solutionContext.Solution.Projects.First();
                updatedRawInfo  = File.ReadAllText(project.AssemblyInfo.Path);
            });

            "Then it should update the assembly file version"
            ._(() =>
            {
                updatedRawInfo.Should().Contain("[assembly: AssemblyFileVersionAttribute(\"0.1.20\")]");
                project.AssemblyInfo.FileVersion.Should().Be(new Version(0, 1, 20));
            });

            "Then it should update the informational version attribute"
            ._(() =>
            {
                updatedRawInfo.Should().Contain("[assembly: AssemblyInformationalVersionAttribute(\"DEBUG\")]");
                project.AssemblyInfo.InformationalVersion.Should().Be("DEBUG");
            });

            "Then it should update the assembly version"
            ._(() =>
            {
                updatedRawInfo.Should().Contain("[assembly: AssemblyVersionAttribute(\"0.1.0.0\")]");
                project.AssemblyInfo.Version.Should().Be(new Version(0, 1, 0, 0));
            });

            "Then it not update the assembly title as it was not changed"
            ._(() =>
            {
                updatedRawInfo.Should().Contain("[assembly: AssemblyTitleAttribute(\"Sally\")]");
                project.AssemblyInfo.Title.Should().Be("Sally");
            })
            .Teardown(() => context.TearDown());
        }
Ejemplo n.º 31
0
        public void patch_solution_assembly_should_only_patch_non_test_projects(CraneRunner craneRunner, RunResult result, CraneTestContext craneTestContext,
                                                                                ISolutionContext solutionContext, ICraneApi craneApi, AssemblyInfo originalAssemblyInfo)
        {
            "Given I have my own private copy of the crane console"
            ._(() => craneTestContext = ServiceLocator.Resolve <CraneTestContext>());

            "And I have a run context"
            ._(() => craneRunner = new CraneRunner());

            "And I have an instance of the crane api"
            ._(() => craneApi = ServiceLocator.Resolve <ICraneApi>());

            "And I have run crane init ServiceStack"
            ._(() => result = craneRunner.Command(craneTestContext.BuildOutputDirectory, "crane init ServiceStack"));

            "And I have got the solution context using the api"
            ._(() =>
            {
                craneApi             = ServiceLocator.Resolve <ICraneApi>();
                solutionContext      = craneApi.GetSolutionContext(Path.Combine(craneTestContext.BuildOutputDirectory, "ServiceStack"));
                originalAssemblyInfo =
                    solutionContext.Solution.Projects.First(p => p.Name == "ServiceStack.UnitTests").AssemblyInfo;
            });

            "And I have created one a solution with one code project called ServiceStack"
            ._(() => solutionContext.Solution.Projects.First(p => p.Name == "ServiceStack").TestProject.Should().BeFalse());

            "And I have created one a solution with one test project called ServiceStack.UnitTests"
            ._(() => solutionContext.Solution.Projects.First(p => p.Name == "ServiceStack.UnitTests").TestProject.Should().BeTrue());

            "When I path the solution assembly info for all projects"
            ._(() =>
            {
                craneApi.PatchSolutionAssemblyInfo(solutionContext, "1.2.3.4");
                solutionContext = craneApi.GetSolutionContext(Path.Combine(craneTestContext.BuildOutputDirectory, "ServiceStack"));
            });

            "It should patch the code project's assemblyinfo version"
            ._(() => solutionContext.Solution.Projects.First(p => !p.TestProject)
               .AssemblyInfo.Version.ToString().Should().Be("1.2.3.4"));

            "It should patch the code project's assemblyinfo file version"
            ._(() => solutionContext.Solution.Projects.First(p => !p.TestProject)
               .AssemblyInfo.FileVersion.ToString().Should().Be("1.2.3.4"));

            "It should patch the code project's assemblyinfo file informational version"
            ._(() => solutionContext.Solution.Projects.First(p => !p.TestProject)
               .AssemblyInfo.InformationalVersion.Should().Be("1.2.3.4"));

            "It should not patch the test project's assemblyinfo version"
            ._(() => solutionContext.Solution.Projects.First(p => p.TestProject)
               .AssemblyInfo.Version.Should().Be(originalAssemblyInfo.Version));

            "It should not patch the test project's assemblyinfo file version"
            ._(() => solutionContext.Solution.Projects.First(p => p.TestProject)
               .AssemblyInfo.FileVersion.Should().Be(originalAssemblyInfo.FileVersion));

            "It should not patch the test project's file informational version"
            ._(() => solutionContext.Solution.Projects.First(p => p.TestProject)
               .AssemblyInfo.InformationalVersion.Should().Be(originalAssemblyInfo.InformationalVersion))
            .Teardown(() => craneTestContext.TearDown());
        }
Ejemplo n.º 32
0
        public void map_fubu_solution_to_crane_solution(IFubuSolutionMapper solutionMapper, SolutionBuilderContext context, ISolutionContext solutionContext, Solution result)
        {
            "Given I have a solution mapper"
            ._(() => solutionMapper = ServiceLocator.Resolve <IFubuSolutionMapper>());

            "And I have a solution builder context"
            ._(() => context = ServiceLocator.Resolve <SolutionBuilderContext>());

            "And I have a solution with two projects"
            ._(() => solutionContext = context.CreateBuilder()
                                       .WithSolution(item => item.Path = Path.Combine(context.RootDirectory, "Sally.sln"))
                                       .WithProject(item => item.Name  = "FrodoFx")
                                       .WithProject(item => item.Name  = "FrodoFx.UnitTests")
                                       .Build());

            "When I map the fubu solution"
            ._(() => result = solutionMapper.Map(FubuCsProjFile.Solution.LoadFrom(solutionContext.Solution.Path)));

            "It should return a solution"
            ._(() => result.Should().NotBeNull());

            "It should map the solutions name"
            ._(() => result.Name.Should().Be("Sally"));

            "It should map the solutions path"
            ._(() => result.Path.Should().Be(Path.Combine(context.RootDirectory, "Sally.sln")));

            "It should map the solutions projects"
            ._(() => result.Projects.Count().Should().Be(2));

            "It should map the solutions projects that reference their parent solution"
            ._(() => result.Projects.All(item => item.Solution.Equals(result)).Should().BeTrue())
            .Teardown(() => context.TearDown());
        }