Exemple #1
0
        public async Task noIndexHeader()
        {
            var listener  = Structure.Start(new SimpleProperties(), TestOptions(next => env => env.Response(200)));
            var exception = await HttpErrors.Dequeue();

            exception.ShouldBeOfType <InvalidOperationException>();

            await listener.Stop();
        }
Exemple #2
0
        public async Task throws()
        {
            var listener = Structure.Start(
                new SimpleProperties(),
                TestOptions(next => env => { throw new OperationCanceledException(); }));

            var exception = await HttpErrors.Dequeue();

            exception.ShouldBeOfType <OperationCanceledException>();

            await listener.Stop();
        }
Exemple #3
0
        public async Task nanIndexHeader()
        {
            var listener = Structure.Start(
                new SimpleProperties(),
                TestOptions(
                    next => env =>
            {
                env.Response.Headers["X-Consul-Index"] = "nope";
                return(env.Response(200));
            }));

            ConsulKvSimulator.PutKey("kv", "nope");
            var exception = await HttpErrors.Dequeue();

            exception.ShouldBeOfType <InvalidOperationException>();

            await listener.Stop();
        }
Exemple #4
0
        public async Task tooManyIndexHeader()
        {
            var listener = Structure.Start(
                new SimpleProperties(),
                TestOptions(
                    next => env =>
            {
                env.Response.Headers.Add("X-Consul-Index", new[] { "1", "2" });

                return(env.Response(200));
            }));

            ConsulKvSimulator.PutKey("kv", "nope");
            var exception = await HttpErrors.Dequeue();

            Trace.WriteLine(exception.Message);
            exception.ShouldBeOfType <InvalidOperationException>();

            await listener.Stop();
        }