Skip to content

Instantly share code, notes, and snippets.

@heemskerkerik
Last active July 30, 2018 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heemskerkerik/f5eb30770a6a8037e70faecce87d181a to your computer and use it in GitHub Desktop.
Save heemskerkerik/f5eb30770a6a8037e70faecce87d181a to your computer and use it in GitHub Desktop.
Test Hang Repro Project
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="xunit.runner.console" version="2.4.0" />
<package id="NUnit.ConsoleRunner" version="3.8.0" />
</packages>
#!/usr/bin/env bash
nuget restore packages.config -PackagesDirectory ./packages
nuget restore TestHang.csproj
msbuild /v:q
mono ./packages/xunit.runner.console.2.4.0/tools/net462/xunit.console.exe ./bin/Debug/net462/TestHang.dll
mono ./packages/NUnit.ConsoleRunner.3.8.0/tools/nunit3-console.exe ./bin/Debug/net462/TestHang.dll
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net462</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
<PackageReference Include="NUnit" Version="3.10.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
<PackageReference Include="RestSharp" Version="106.2.1" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
</ItemGroup>
</Project>
using System.Collections.Generic;
using NUnit.Framework;
using RestSharp;
using Xunit;
namespace TestHang
{
public class XunitTest
{
[Fact]
public void Xunit_Execute_WhenRequestIsPost_DoesNotHang()
{
var client = new RestClient("https://httpbin.org/");
var request = new RestRequest("post", Method.POST);
request.AddJsonBody(
new Dictionary<string, string>
{
{ "hello", "world" },
}
);
client.Execute(request);
}
}
public class NUnitTest
{
[Test]
public void NUnit_Execute_WhenRequestIsPost_DoesNotHang()
{
var client = new RestClient("https://httpbin.org/");
var request = new RestRequest("post", Method.POST);
request.AddJsonBody(
new Dictionary<string, string>
{
{ "hello", "world" },
}
);
client.Execute(request);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment