Skip to content

Instantly share code, notes, and snippets.

@RhysC
Created March 18, 2016 11:10
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 RhysC/4b2c9e12143461f4d259 to your computer and use it in GitHub Desktop.
Save RhysC/4b2c9e12143461f4d259 to your computer and use it in GitHub Desktop.
Xunit skip/ignore until a given date
//using System;
//using Xunit;
public class IgnoreUntilFactAttribute : FactAttribute
{
public int Year { get; set; }
public int Month { get; set; }
public int Day { get; set; }
public override string Skip
{
get
{
var skipUntil = new DateTime(Year, Month, Day);
var shouldSkip = DateTime.Now < skipUntil;
if (shouldSkip)
{
return "Skipping until " + skipUntil.ToShortDateString();
}
return null;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment