Beispiel #1
0
        public void RemoteServerShouldWorkCorrectlyWithGlobalConfiguration()
        {
            MyHttpServer.IsLocatedAt("http://google.com", clientHandler =>
            {
                clientHandler.AllowAutoRedirect = true;
            });

            MyHttpServer
            .WorkingRemotely()
            .WithHttpRequestMessage(req => req.WithMethod(HttpMethod.Get))
            .ShouldReturnHttpResponseMessage()
            .WithResponseTime(time => time.TotalMilliseconds > 0)
            .WithStatusCode(HttpStatusCode.OK)
            .ContainingContentHeader(HttpContentHeader.ContentType);

            MyHttpServer
            .WorkingRemotely()
            .WithHttpRequestMessage(req => req.WithMethod(HttpMethod.Delete))
            .ShouldReturnHttpResponseMessage()
            .WithResponseTime(time => time.TotalMilliseconds > 0)
            .WithStatusCode(HttpStatusCode.MethodNotAllowed);

            MyHttpServer
            .WorkingRemotely()
            .WithHttpRequestMessage(req => req.WithRequestUri("/notfound"))
            .ShouldReturnHttpResponseMessage()
            .WithResponseTime(time => time.TotalMilliseconds > 0)
            .WithStatusCode(HttpStatusCode.NotFound);

            RemoteServer.DisposeGlobal();
        }