Created
February 17, 2017 23:42
-
-
Save carlin-q-scott/705a69a336d84271455a80bdbb55141f to your computer and use it in GitHub Desktop.
This file contains 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
/// <summary> | |
/// Note that if this is the end of your assertion chain then append () or .Invoke() to the end | |
/// </summary> | |
/// <param name="action"></param> | |
/// <param name="time"></param> | |
/// <param name="precision"></param> | |
/// <returns></returns> | |
public static Action ShouldTakeCloseTo(this Action action, TimeSpan time) | |
{ | |
return () => | |
{ | |
var startTime = DateTime.Now; | |
action(); | |
TimeSpan executionTimespan = DateTime.Now - startTime; | |
executionTimespan.Should().BeCloseTo(time); | |
}; | |
} | |
public static Action And(this Action action) | |
{ | |
return action; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment