public void BetweenTest() { var matchers = Matchers ( ATimeSpan.Between(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(7)), ATimeSpan.Between(5, 7).Seconds(), ATimeSpan.Between(5000, 7000).Milliseconds() ); foreach (var matcher in matchers) { AssertFails(TimeSpan.FromSeconds(4), matcher); AssertFails(TimeSpan.FromSeconds(5), matcher); AssertFails(TimeSpan.FromMilliseconds(5000), matcher); AssertPasses(TimeSpan.FromSeconds(6), matcher); AssertPasses(TimeSpan.FromMilliseconds(6000), matcher); AssertFails(TimeSpan.FromSeconds(7), matcher); AssertFails(TimeSpan.FromMilliseconds(7000), matcher); AssertFails(TimeSpan.FromSeconds(8), matcher); } }
public void FluentMultiArgMatcherTest() { AssertFails(TimeSpan.FromSeconds(2), ATimeSpan.Between(3000, 5000).Milliseconds()); AssertPasses(TimeSpan.FromSeconds(4), ATimeSpan.Between(3000, 5000).Milliseconds()); AssertFails(TimeSpan.FromSeconds(6), ATimeSpan.Between(3000, 5000).Milliseconds()); AssertFails(TimeSpan.FromSeconds(2), ATimeSpan.Between(3, 5).Seconds()); AssertPasses(TimeSpan.FromSeconds(4), ATimeSpan.Between(3, 5).Seconds()); AssertFails(TimeSpan.FromSeconds(6), ATimeSpan.Between(3, 5).Seconds()); AssertFails(TimeSpan.FromMinutes(2), ATimeSpan.Between(3, 5).Minutes()); AssertPasses(TimeSpan.FromMinutes(4), ATimeSpan.Between(3, 5).Minutes()); AssertFails(TimeSpan.FromMinutes(6), ATimeSpan.Between(3, 5).Minutes()); AssertFails(TimeSpan.FromHours(2), ATimeSpan.Between(3, 5).Hours()); AssertPasses(TimeSpan.FromHours(4), ATimeSpan.Between(3, 5).Hours()); AssertFails(TimeSpan.FromHours(6), ATimeSpan.Between(3, 5).Hours()); AssertFails(TimeSpan.FromDays(2), ATimeSpan.Between(3, 5).Days()); AssertPasses(TimeSpan.FromDays(4), ATimeSpan.Between(3, 5).Days()); AssertFails(TimeSpan.FromDays(6), ATimeSpan.Between(3, 5).Days()); }