Skip to content

Commit

Permalink
Allow for a small marging when verifying whether configured timeout w…
Browse files Browse the repository at this point in the history
…as respected.
  • Loading branch information
drieseng committed Dec 31, 2020
1 parent 41e378c commit 0085562
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public void ConnectShouldHaveRespectedTimeout()
_stopWatch.ElapsedMilliseconds,
_connectionInfo.Timeout.TotalMilliseconds);

Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds, errorText);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ public void ConnectShouldHaveRespectedTimeout()
_stopWatch.ElapsedMilliseconds,
_connectionInfo.Timeout.TotalMilliseconds);

Assert.IsTrue(_stopWatch.ElapsedMilliseconds < (_connectionInfo.Timeout.TotalMilliseconds + 100), errorText);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ public void ConnectShouldHaveRespectedTimeout()
_stopWatch.ElapsedMilliseconds,
_connectionInfo.Timeout.TotalMilliseconds);

Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < (_connectionInfo.Timeout.TotalMilliseconds + 100), errorText);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ public void ConnectShouldHaveRespectedTimeout()
_stopWatch.ElapsedMilliseconds,
_connectionInfo.Timeout.TotalMilliseconds);

Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds, errorText);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ public void ConnectShouldHaveRespectedTimeout()
_stopWatch.ElapsedMilliseconds,
_connectionInfo.Timeout.TotalMilliseconds);

Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < (_connectionInfo.Timeout.TotalMilliseconds + 100), errorText);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@ public void ConnectShouldHaveRespectedTimeout()
_stopWatch.ElapsedMilliseconds,
_connectionInfo.Timeout.TotalMilliseconds);

Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < (_connectionInfo.Timeout.TotalMilliseconds + 100), errorText);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ public void ConnectShouldHaveRespectedTimeout()
_stopWatch.ElapsedMilliseconds,
_connectionInfo.Timeout.TotalMilliseconds);

Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < (_connectionInfo.Timeout.TotalMilliseconds + 100), errorText);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public void ConnectShouldHaveRespectedTimeout()
_stopWatch.ElapsedMilliseconds,
_connectionInfo.Timeout.TotalMilliseconds);

Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds, errorText);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ public void ConnectShouldHaveRespectedTimeout()
_stopWatch.ElapsedMilliseconds,
_connectionInfo.Timeout.TotalMilliseconds);

Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < (_connectionInfo.Timeout.TotalMilliseconds + 100), errorText);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ public void ConnectShouldHaveRespectedTimeout()
_stopWatch.ElapsedMilliseconds,
_connectionInfo.Timeout.TotalMilliseconds);

Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < (_connectionInfo.Timeout.TotalMilliseconds + 100), errorText);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ public void ConnectShouldHaveRespectedTimeout()
_stopWatch.ElapsedMilliseconds,
_connectionInfo.Timeout.TotalMilliseconds);

Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < (_connectionInfo.Timeout.TotalMilliseconds + 100), errorText);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ public void ConnectShouldHaveRespectedTimeout()
_stopWatch.ElapsedMilliseconds,
_connectionInfo.Timeout.TotalMilliseconds);

Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < (_connectionInfo.Timeout.TotalMilliseconds + 100), errorText);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public void ConnectShouldHaveRespectedTimeout()
_stopWatch.ElapsedMilliseconds,
_connectionInfo.Timeout.TotalMilliseconds);

Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds, errorText);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ public void ConnectShouldHaveRespectedTimeout()
_stopWatch.ElapsedMilliseconds,
_connectionInfo.Timeout.TotalMilliseconds);

Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < (_connectionInfo.Timeout.TotalMilliseconds + 100), errorText);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
}

[TestMethod]
Expand Down

0 comments on commit 0085562

Please sign in to comment.