예제 #1
0
            public void DisposesProcessRunners()
            {
                Container.Stop(false);

                ProcessRunner.Received(1).Dispose();
                ConstrainedProcessRunner.Received(1).Dispose();
            }
예제 #2
0
            public void ChangesStateToStopped()
            {
                Container.Stop(false);
                var info = Container.GetInfo();

                Assert.Equal(ContainerState.Stopped, info.State);
            }
예제 #3
0
            public void WhenContainerNotActive_Throws()
            {
                Container.Stop(false);
                Action action = () => Container.LimitDisk(5);

                Assert.Throws <InvalidOperationException>(action);
            }
예제 #4
0
            public void WhenContainerStopped_Runs()
            {
                Container.Stop(false);
                Container.Destroy();

                ProcessRunner.Received(1).Dispose();
            }
예제 #5
0
            public void WhenContainerNotActive_Throws()
            {
                Container.Stop(false);
                Action action = () => Container.ReservePort(3000);

                Assert.Throws <InvalidOperationException>(action);
            }
예제 #6
0
            public void WhenContainerDestroyed_Throws()
            {
                Container.Destroy();

                Action action = () => Container.Stop(false);

                Assert.Throws <InvalidOperationException>(action);
            }
예제 #7
0
            public void WhenContainerNotActive_Throws()
            {
                var io = Substitute.For <IProcessIO>();

                Container.Stop(false);
                Action action = () => Container.Run(Spec, io);

                Assert.Throws <InvalidOperationException>(action);
            }
예제 #8
0
            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();
            }
예제 #9
0
            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);
            }