public void DisposesProcessRunners() { Container.Stop(false); ProcessRunner.Received(1).Dispose(); ConstrainedProcessRunner.Received(1).Dispose(); }
public void ChangesStateToStopped() { Container.Stop(false); var info = Container.GetInfo(); Assert.Equal(ContainerState.Stopped, info.State); }
public void WhenContainerNotActive_Throws() { Container.Stop(false); Action action = () => Container.LimitDisk(5); Assert.Throws <InvalidOperationException>(action); }
public void WhenContainerStopped_Runs() { Container.Stop(false); Container.Destroy(); ProcessRunner.Received(1).Dispose(); }
public void WhenContainerNotActive_Throws() { Container.Stop(false); Action action = () => Container.ReservePort(3000); Assert.Throws <InvalidOperationException>(action); }
public void WhenContainerDestroyed_Throws() { Container.Destroy(); Action action = () => Container.Stop(false); Assert.Throws <InvalidOperationException>(action); }
public void WhenContainerNotActive_Throws() { var io = Substitute.For <IProcessIO>(); Container.Stop(false); Action action = () => Container.Run(Spec, io); Assert.Throws <InvalidOperationException>(action); }
public void WhenContainerStopAllThrows_CallsJobobjectTerminate() { ConstrainedProcessRunner .When(x => x.StopAll(true)) .Do(x => { throw new TimeoutException("Test timeout exception"); }); Container.Stop(true); JobObject.Received(1).TerminateProcessesAndWait(); }
public void WhenContainerStopped_Runs() { JobObject.GetCpuStatistics().Returns(new CpuStatistics { TotalKernelTime = TimeSpan.Zero, TotalUserTime = TimeSpan.Zero, }); JobObject.GetProcessIds().Returns(new int[0]); Container.Stop(false); var info = Container.GetInfo(); Assert.NotNull(info); }