public void GetHashCodeIsStable() { var codes = new List <int>(); var retry = new ExponentialRetry(TimeSpan.FromMinutes(1), TimeSpan.FromHours(1), 22); for (var index = 0; index < 10; ++index) { codes.Add(retry.GetHashCode()); } Assert.That(codes.Distinct().Count(), Is.EqualTo(1)); }
public void GetHashCodeIsTheSameWhenPropertiesMatch() { ExponentialRetry retry; var codes = new List <int>(); for (var index = 0; index < 10; ++index) { retry = new ExponentialRetry(TimeSpan.FromMinutes(1), TimeSpan.FromHours(1), 22); codes.Add(retry.GetHashCode()); } Assert.That(codes.Distinct().Count(), Is.EqualTo(1)); }
public void GetHashCodeDiffersWhenPropertiesDoNotMatch() { ExponentialRetry retry; var count = 10; var codes = new List <int>(); for (var index = 0; index < count; ++index) { retry = new ExponentialRetry(TimeSpan.FromMinutes(index), TimeSpan.FromMilliseconds(index + 1), (index + 22)); codes.Add(retry.GetHashCode()); } Assert.That(codes.Distinct().Count(), Is.EqualTo(count)); }