mirror of
https://github.com/BepInEx/dotnet-runtime.git
synced 2026-11-27 13:19:31 -10:00
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
34 lines
1.1 KiB
C#
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);
|
|
}
|
|
}
|
|
}
|
|
}
|