Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/// <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
You can’t perform that action at this time.