Skip to content

Commit

Permalink
Use int instead of uint
Browse files Browse the repository at this point in the history
  • Loading branch information
hibri committed Feb 25, 2018
1 parent eadbce1 commit 1235519
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/HttpMock.Integration.Tests/HttpEndPointTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public void Should_wait_more_than_the_added_delay(int wait, int added)
var stub = _stubHttp.Stub(x => x.Get("/endpoint")).Return("Delayed response");
stub.OK();

stub.WithDelay(Convert.ToUInt32(wait));
stub.WithDelay(wait);
string ans;
var sw = new Stopwatch();

Expand Down Expand Up @@ -359,7 +359,7 @@ public async Task<string> StartDelayedRequest(Stopwatch sw)
public void Delayed_stub_shouldnt_block_undelayed_stub(int wait, int epsilon)
{
_stubHttp = HttpMockRepository.At(_hostUrl);
_stubHttp.Stub(x => x.Get("/firstEndp")).WithDelay(Convert.ToUInt32(wait)).Return("Delayed response (stub 1)").OK();
_stubHttp.Stub(x => x.Get("/firstEndp")).WithDelay(wait).Return("Delayed response (stub 1)").OK();
_stubHttp.Stub(x => x.Get("/secondEndp")).Return("Undelayed response (stub 2)").OK();

Stopwatch swDelayed = new Stopwatch();
Expand All @@ -372,8 +372,9 @@ public void Delayed_stub_shouldnt_block_undelayed_stub(int wait, int epsilon)
{

// This triggers the server so that we won't have any initial (unwanted) delays

wcDelayed.DownloadString($"{_hostUrl}/firstEndp");
wcUndelayed.DownloadString($"{_hostUrl}/secondEndp");
wcUndelayed.DownloadString($"{_hostUrl}/secondEndp");

taskDelayed = StartDelayedRequest(swDelayed);

Expand Down
2 changes: 1 addition & 1 deletion src/HttpMock/IRequestStub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public interface IRequestStub
IRequestStub AddHeader( string header, string headerValue);
IRequestStub WithUrlConstraint(Func<string, bool> constraint);
IRequestStub ReturnFileRange(string pathToFile, int from, int to);
IRequestStub WithDelay(uint milliseconds);
IRequestStub WithDelay(int milliseconds);
IRequestStub WithDelay(TimeSpan timeSpan);
}
}
2 changes: 1 addition & 1 deletion src/HttpMock/RequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public IEnumerable<ReceivedRequest> GetObservedRequests()
return _observedRequests;
}

public IRequestStub WithDelay(uint milliseconds)
public IRequestStub WithDelay(int milliseconds)
{
ResponseDelay = ResponseDelay.Add(TimeSpan.FromMilliseconds(milliseconds));
return this;
Expand Down

0 comments on commit 1235519

Please sign in to comment.