示例#1
0
        public void Start_should_throw_on_initialize_fail()
        {
            application = new BadApplication(true);
            host        = new VostokHost(new TestHostSettings(application, SetupEnvironment));

            Action checkStart = () => host.Start(VostokApplicationState.Initialized);

            checkStart.Should().Throw <Exception>().WithMessage("initialize");

            Action checkStop = () => host.Stop();

            checkStop.Should().Throw <Exception>().WithMessage("initialize");
        }
示例#2
0
        public void Should_not_block_on_dispose_longer_than_shutdown_timeout_allows()
        {
            var app = new DisposableApplication
            {
                DisposeDelay = 10.Seconds()
            };

            var host = new VostokHost(new TestHostSettings(app, SetupEnvironment));

            host.Start();

            var watch = Stopwatch.StartNew();

            host.Stop().State.Should().Be(VostokApplicationState.Exited);

            watch.Elapsed.Should().BeLessThan(2.Seconds());
        }