Exemplo n.º 1
0
            public void ChangesStateToStopped()
            {
                Container.Stop(false);
                var info = Container.GetInfo();

                Assert.Equal(ContainerState.Stopped, info.State);
            }
Exemplo n.º 2
0
            public void WhenContainerDestroyed_Throws()
            {
                Container.Destroy();
                Action action = () => Container.GetInfo();

                Assert.Throws <InvalidOperationException>(action);
            }
Exemplo n.º 3
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);
            }
Exemplo n.º 4
0
            public void ReturnsListOfReservedPorts()
            {
                TcpPortManager.ReserveLocalPort(1000, Arg.Any <string>()).Returns(1000);
                TcpPortManager.ReserveLocalPort(1001, Arg.Any <string>()).Returns(1001);

                Container.ReservePort(1000);
                Container.ReservePort(1001);

                var info = Container.GetInfo();

                Assert.Collection(info.ReservedPorts,
                                  x => Assert.Equal(1000, x),
                                  x => Assert.Equal(1001, x)
                                  );
            }
Exemplo n.º 5
0
            public void ReturnsProperties()
            {
                var properties = new Dictionary <string, string>()
                {
                    { "name1", "value1" },
                    { "name2", "value2" },
                };

                ContainerPropertiesService.GetProperties(Container).Returns(properties);

                var info = Container.GetInfo();

                Assert.Equal(
                    new HashSet <string>(properties.Keys),
                    new HashSet <string>(info.Properties.Keys)
                    );
            }