public void can_get_crane_context(CraneTestContext craneTestContext, PowerShellApiRunner apiRunner, RunResult commandResult, CraneRunner craneRunner) { "Given I have my own private copy of the crane console" ._(() => craneTestContext = ServiceLocator.Resolve <CraneTestContext>()); "And I have my powershell api runner" ._(() => apiRunner = new PowerShellApiRunner(craneTestContext, TimeSpan.FromSeconds(15))); "And I have initialized a project called ServiceStack" ._(() => { craneRunner = new CraneRunner(); craneRunner.Command(craneTestContext.BuildOutputDirectory, "crane init ServiceStack"); }); "When I get the context using powershell" ._(() => commandResult = apiRunner.Run("Get-CraneSolutionContext -Path \'{0}\' | FL", Path.Combine(craneTestContext.BuildOutputDirectory, "ServiceStack"))); "Then there should be no error" ._(() => commandResult.Should().BeErrorFree()); "It should write the solution context to the powershell pipeline" ._(() => commandResult.StandardOutput.Should() .Contain(Path.Combine(craneTestContext.BuildOutputDirectory, "ServiceStack"))) .Teardown(() => craneTestContext.TearDown()); }
public void should_update_all_code_assembly_infos(CraneTestContext craneTestContext, PowerShellApiRunner apiRunner, RunResult commandResult, ICraneApi craneApi, string projectDir) { "Given I have my own private copy of the crane console" ._(() => craneTestContext = ServiceLocator.Resolve <CraneTestContext>()); "And I have my powershell api runner" ._(() => apiRunner = new PowerShellApiRunner(craneTestContext, TimeSpan.FromSeconds(15))); "And I have a crane api" ._(() => craneApi = ServiceLocator.Resolve <ICraneApi>()); "And I have initialized a project called ServiceStack" ._(() => { var craneRunner = new CraneRunner(); craneRunner.Command(craneTestContext.BuildOutputDirectory, "crane init ServiceStack"); projectDir = Path.Combine(craneTestContext.BuildOutputDirectory, "ServiceStack"); }); "When I update the solution assembly infos" ._(() => commandResult = apiRunner.Run(@"$context = Get-CraneSolutionContext -Path '{0}'; Update-CraneAllProjectsAssemblyInfos -SolutionContext $context -Version '4.5.6.7'", projectDir)); "Then there should be no error" ._(() => commandResult.Should().BeErrorFree()); "And the assembly info file should be patched for each code project" ._(() => craneApi.GetSolutionContext(projectDir).Solution.Projects.Where(p => !p.TestProject) .All(p => p.AssemblyInfo.Version.ToString() == "4.5.6.7") .Should() .BeTrue() ).Teardown(() => craneTestContext.TearDown()); }
public void invoking_command_packages_nuget_spec_file_correctly( CraneRunner craneRunner, RunResult buildResult, RunResult commandResult, CraneTestContext craneTestContext, string projectDir, ICraneApi craneApi, PowerShellApiRunner apiRunner) { "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" ._(() => buildResult = craneRunner.Command(craneTestContext.BuildOutputDirectory, "crane init ServiceStack")); "And I have build the project" ._(() => { buildResult = new BuildScriptRunner().Run(Path.Combine(craneTestContext.BuildOutputDirectory, "ServiceStack")); buildResult.Should().BeBuiltSuccessfulyWithAllTestsPassing().And.BeErrorFree(); projectDir = Path.Combine(craneTestContext.BuildOutputDirectory, "ServiceStack"); }); "And I have my powershell api runner" ._(() => apiRunner = new PowerShellApiRunner(craneTestContext, TimeSpan.FromSeconds(15))); "When I call invoke all nuget pack" ._(() => commandResult = apiRunner.Run( @"$context = Get-CraneSolutionContext -Path '{0}'; " + "Invoke-CraneNugetPackAllProjects -SolutionContext $context -BuildOutputPath '{1}' -NugetOutputPath '{2}' -Version {3}" + "| % {{ $_.StandardOutput }}", projectDir, Path.Combine(projectDir, "build-output"), Path.Combine(projectDir, "build-output", "nuGet"), "0.0.0.0")); "Then there should be no error" ._(() => commandResult.Should().BeErrorFree()); "And the nuget package should have been created" ._(() => File.Exists(Path.Combine(projectDir, "build-output", "nuGet", "ServiceStack.0.0.0.0.nupkg")).Should().BeTrue()) .Teardown(() => craneTestContext.TearDown()); }