I have many Action
objects with a property long Timestamp
. I want to do something like this:
Assert.IsTrue(a1.Timestamp < a2.Timestamp < a3.Timestamp < ... < an.Timestamp);
Unfortunately, this syntax is illegal. Is there a built-in way or a extension\LINQ\whatever way to perform this?
Note that it's target for a unit test class, so get crazy. I don't care about performance, readability and etc.
private static bool isValid(params Action[] actions)
{
for (int i = 1; i < actions.Length; i++)
if (actions[i-1].TimeStamp >= actions[i].TimeStamp)
return false;
return true;
}
Assert.IsTrue(isValid(a1,a2,...,an));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With