public async Task Should_not_be_allowed_twice()
        {
            var loggerFactory = new TestOutputLoggerFactory(true);

            LogContext.ConfigureCurrentLogContext(loggerFactory);

            DiagnosticListener.AllListeners.Subscribe(new DiagnosticListenerObserver());

            var secondHarness = new RabbitMqTestHarness();

            try
            {
                Assert.That(async() =>
                {
                    using (var token = new CancellationTokenSource(TimeSpan.FromSeconds(10)))
                    {
                        await secondHarness.Start(token.Token).OrCanceled(TestCancellationToken);

                        await secondHarness.Stop();
                    }
                }, Throws.TypeOf <RabbitMqConnectionException>());
            }
            finally
            {
                secondHarness.Dispose();
            }
        }
Ejemplo n.º 2
0
        public async Task Should_not_be_allowed_twice()
        {
            var secondHarness = new RabbitMqTestHarness();

            try
            {
                Assert.That(async() =>
                {
                    await secondHarness.Start();

                    await secondHarness.Stop();
                }, Throws.TypeOf <RabbitMqConnectionException>());
            }
            finally
            {
                secondHarness.Dispose();
            }
        }
        public async Task Should_not_be_allowed_twice()
        {
            var secondHarness = new RabbitMqTestHarness();

            try
            {
                Assert.That(async() =>
                {
                    using (var token = new CancellationTokenSource(TimeSpan.FromSeconds(10)))
                    {
                        await secondHarness.Start(token.Token);

                        await secondHarness.Stop();
                    }
                }, Throws.TypeOf <RabbitMqConnectionException>());
            }
            finally
            {
                secondHarness.Dispose();
            }
        }
        public async Task Should_not_be_allowed_twice()
        {
            var secondHarness = new RabbitMqTestHarness {
                CleanVirtualHost = false
            };

            try
            {
                Assert.That(async() =>
                {
                    using var token = new CancellationTokenSource(TimeSpan.FromSeconds(5));

                    await secondHarness.Start(token.Token).OrCanceled(TestCancellationToken);

                    await secondHarness.Stop();
                }, Throws.TypeOf <RabbitMqConnectionException>());
            }
            finally
            {
                secondHarness.Dispose();
            }
        }