Skip to content

Instantly share code, notes, and snippets.

@pawelpabich
Created April 28, 2014 06:06
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 pawelpabich/11362860 to your computer and use it in GitHub Desktop.
Save pawelpabich/11362860 to your computer and use it in GitHub Desktop.
using System;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
using Xunit.Sdk;
namespace XUnitMany
{
public class Class1
{
[Fact]
public void Test11()
{
Console.WriteLine("P11B");
Thread.Sleep(5000);
Console.WriteLine("P11E");
}
[Fact]
public void Test12()
{
Console.WriteLine("P12B");
Thread.Sleep(5000);
Console.WriteLine("P12E");
}
}
public class Class2
{
public Class2()
{
Thread.Sleep(1000);
}
[Fact]
public void Test21()
{
Console.WriteLine("P21B");
Thread.Sleep(5000);
Console.WriteLine("P21E");
}
[Fact]
[SleepBeforeAndAfer]
public void Test22()
{
Console.WriteLine("P22B");
Thread.Sleep(5000);
Console.WriteLine("P22E");
}
[Fact]
[SleepBeforeAndAfer]
public Task Test23()
{
Console.WriteLine("P22B");
Thread.Sleep(5000);
Console.WriteLine("P22E");
return Task.Delay(1);
}
}
public class SleepBeforeAndAfer : BeforeAfterTestAttribute
{
public override void Before(MethodInfo methodUnderTest)
{
Thread.Sleep(2000);
}
public override void After(MethodInfo methodUnderTest)
{
Thread.Sleep(2000);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment