public void CompositeWithAverageSelectorReturnsAverageWaitTime() { var strategy = new CompositeBackoffStrategy(_strategies, waitTimes => TimeSpan.FromMilliseconds(waitTimes.Average(time => time.TotalMilliseconds))); var waitTime = strategy.Next(); Assert.Equal(TimeSpan.FromMilliseconds(_initialWaitTimes.Average(time => time.TotalMilliseconds)), waitTime); }
public void CompositeWithMinSelectorReturnsMinWaitTime() { var strategy = new CompositeBackoffStrategy(_strategies, waitTimes => waitTimes.Min()); var waitTime = strategy.Next(); Assert.Equal(_initialWaitTimes.Min(), waitTime); }
public void CompositeSelectorReturnsCompletelyDifferentWaitTime() { var completelyDifferentWaitTime = TimeSpan.FromSeconds(23); var strategy = new CompositeBackoffStrategy(_strategies, waitTimes => completelyDifferentWaitTime); var waitTime = strategy.Next(); Assert.Equal(completelyDifferentWaitTime, waitTime); }