public async void WhenProcessExits_RemovesProcessFromTracker()
        {
            ExpectedProcess.WaitForExit(ExpectedParams.timeout).Returns(true);
            ExpectedProcess.ExitCode.Returns(100);

            await Handler.ExecuteAsync(ExpectedParams);

            ProcessTracker.Received().RemoveProcess(ExpectedParams.key);
        }
Exemple #2
0
        public async void WiresUpStandardIo()
        {
            Action <string> outputCallback = null;
            Action <string> errorCallback  = null;

            ProcessRunner.Run(null).ReturnsForAnyArgs(ExpectedProcess)
            .AndDoes(call =>
            {
                var spec       = call.Arg <ProcessRunSpec>();
                outputCallback = spec.OutputCallback;
                errorCallback  = spec.ErrorCallback;
            });

            await Handler.ExecuteAsync(ExpectedParams);

            Assert.NotNull(outputCallback);
            Assert.NotNull(errorCallback);

            outputCallback("This is STDOUT");
            errorCallback("This is STDERR");

            ProcessTracker.Received(1).HandleProcessData(ExpectedParams.key, ProcessDataType.STDOUT, "This is STDOUT");
            ProcessTracker.Received(1).HandleProcessData(ExpectedParams.key, ProcessDataType.STDERR, "This is STDERR");
        }
Exemple #3
0
        public async void AddsProcessToTracker()
        {
            await Handler.ExecuteAsync(ExpectedParams);

            ProcessTracker.Received(1).TrackProcess(ExpectedParams.key, ExpectedProcess);
        }