public int TimeShouldIncreaseExponentially(int calls) { //Arrange var backo = new Backo(jitter: 0); //Act for (var i = 0; i < calls - 1; i++) { backo.AttemptTime(); } var time = backo.AttemptTime(); //Assert return(time); }
public int TimeShouldDependOnFactor(int calls, byte factor) { //Arrange var backo = new Backo(jitter: 0, factor: factor); //Act for (var i = 0; i < calls - 1; i++) { backo.AttemptTime(); } var time = backo.AttemptTime(); //Assert return(time); }
public int TimeShouldDependOnMin(int calls, int min) { //Arrange var backo = new Backo(jitter: 0, min: min); //Act for (var i = 0; i < calls - 1; i++) { backo.AttemptTime(); } var time = backo.AttemptTime(); //Assert return(time); }
public int TimeShouldBeLessOrEqualToMax(int calls, int max) { //Arrange var backo = new Backo(jitter: 0, max: max); //Act for (var i = 0; i < calls - 1; i++) { backo.AttemptTime(); } var time = backo.AttemptTime(); //Assert return(time); }
public void AJitterShouldBeAdded(int calls, ushort jitter, int expectedTime) { //Arrange var backo = new Backo(jitter: jitter); //Act for (var i = 0; i < calls - 1; i++) { backo.AttemptTime(); } var time = backo.AttemptTime(); //Assert Assert.IsTrue(time >= expectedTime); Assert.IsTrue(time - expectedTime <= jitter); }