コード例 #1
0
        public PowerShellApiRunner(ICraneTestContext testContext, TimeSpan timeout)
        {
            _testContext = testContext;
            _fileManager = new FileManager(new HostEnvironment());
            _timer       = new Timer
            {
                Interval = timeout.TotalMilliseconds
            };

            _timer.Elapsed += OnTimerElapsed;
        }
コード例 #2
0
        private void Initialize(ICraneTestContext testContext)
        {
            _testContext = testContext;

            KillAllKlondikeProcesses();

            var binPath   = Path.Combine(_testContext.ToolsDirectory, "klondie", "bin", "Klondike.SelfHost.exe");
            var arguments = string.Format("--port={0}", PortNumber);

            DeleteService();
            CreateService(binPath, arguments);
            StartService();

            Log.Debug("nuGet server started");
        }
コード例 #3
0
        public void build_a_project_and_publish_to_nuget(
            NuGetServerContext nuGetServer,
            ICraneTestContext craneTestContext,
            CraneRunner craneRunner,
            RunResult result)
        {
            // .\src\packages\xunit.runners.1.9.2\tools\xunit.console.clr4.exe .\build-output\Crane.Integration.Tests.dll /trait "Debug=nuGet"
            "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 a nuGet server running"
            ._(() =>
            {
                nuGetServer = new NuGetServerContext(craneTestContext);
                nuGetServer.PackageCount.Should().BeGreaterThan(-1);
            });

            "And I have a project with a nuGet spec file (which is the default behaviour of crane init)"
            ._(() => craneRunner.Command(craneTestContext.BuildOutputDirectory, "crane init SallyFx").ErrorOutput.Should().BeEmpty());

            "When I build the project supplying the nuGet details"
            ._(() =>
            {
                result = new BuildScriptRunner().Run(Path.Combine(craneTestContext.BuildOutputDirectory, "SallyFx"),
                                                     "@('BuildSolution', 'NugetPublish')",
                                                     "-nuget_api_key", nuGetServer.ApiKey,
                                                     "-nuget_api_url", nuGetServer.Source.ToString());
                result.Should().BeBuiltSuccessfulyWithAllTestsPassing().And.BeErrorFree();
            });

            "It should push the package to the nuGet server"
            ._(() => nuGetServer.PackageExists("SallyFx", "0.0.0.0").Should().BeTrue())
            .Teardown(() =>
            {
                nuGetServer.TearDown();
                craneTestContext.TearDown();
            });
        }
コード例 #4
0
 public NuGetServerContext(ICraneTestContext testContext)
 {
     Log.Debug("Initializing NugetSeverContext");
     Initialize(testContext);
 }