Beispiel #1
0
        public void should_be_able_to_verify_not_called_from_named_handler_tracer()
        {
            var server = new MockHttpServer();

            server.AddHandler(new DelegatedRequestHandler(
                                  _ => true,
                                  (r, p, c) => HttpStatusCode.OK.AsResponse(),
                                  "handlerName"));

            IRequestHandlerTracer handlerTracer = server["handlerName"];

            handlerTracer.VerifyNotCalled();
            Assert.Throws <VerifyException>(() => handlerTracer.VerifyHasBeenCalled());
        }
Beispiel #2
0
        public async Task should_be_able_to_verify_called_from_named_handler_tracer()
        {
            var server = new MockHttpServer();

            server.AddHandler(new DelegatedRequestHandler(
                                  _ => true,
                                  (r, p, c) => HttpStatusCode.OK.AsResponse(),
                                  "handlerName"));

            IRequestHandlerTracer handlerTracer = server["handlerName"];

            HttpClient httpClient = CreateClient(server);
            await httpClient.GetAsync("http://uri.that.matches");

            handlerTracer.VerifyHasBeenCalled();
            handlerTracer.VerifyHasBeenCalled(1);
            Assert.Throws <VerifyException>(() => handlerTracer.VerifyNotCalled());
        }