Created
March 18, 2016 11:10
-
-
Save RhysC/4b2c9e12143461f4d259 to your computer and use it in GitHub Desktop.
Xunit skip/ignore until a given date
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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