Files
dotnet-runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs
T
David Shulman 9d997536f4 Port additional System.Net.Http tests to CoreFx
Added more http tests to open source from the original internal ToF tests. Some of
the tests should be refactored in the future to avoid Assert'ing multiple
logical things.

Fixed up test namespaces for System.Net.Http and
System.Net.Http.WinHttpHandler.


Commit migrated from https://github.com/dotnet/corefx/commit/e5a017cb6ca01e99b1f1462298bc0cbf60c06ee0
2015-09-21 11:48:34 -07:00

34 lines
1.1 KiB
C#

// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Net;
using System.Net.Http;
using System.Net.Tests;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
namespace System.Net.Http.Functional.Tests
{
public class HttpClientTest
{
[Fact]
[OuterLoop]
public void Timeout_SetTo60AndGetResponseFromServerWhichTakes40_Success()
{
// TODO: This server path will change once the final test infrastructure is in place (Issue #1477).
const string SlowServer = "http://httpbin.org/drip?numbytes=1&duration=1&delay=40&code=200";
using (var client = new HttpClient())
{
client.Timeout = TimeSpan.FromSeconds(60);
var response = client.GetAsync(SlowServer).GetAwaiter().GetResult();
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}
}
}
}