Skip to content

Commit 3eb53bd

Browse files
mikechu-optimizelymsohailhussainjaeopt
authored
feat: Added ODPEventManager implementation (#320)
* WIP initial ODP event manager * Finish implementing ODP Event Manager; scaffolding tests * WIP ODP Event Manager unit tests * WIP unit tests & fixes * Post merge fixes * WIP Fixing code & tests * Additional unit tests added * Upgraded NUnit+fixed upgrade errors; finished tests Needed control over threading/non-parallel test execution * Internal doc + fix NuGet ref * Doc & fix * Use CountdownEvent Thanks to finding Java's CountDownLatch :-) * Pull request code review changes * Fix batch detection * Legacy changes rollback; Adjust Event Manager test * Fix lint whitespace * PR code revisions * Pull request code review changes * Better handling of Cancel to _flushIntervalCancellation token * Lint fixes * PR review changes * Pull request changes * Fix lint * Test and lint fixes * Update OptimizelySDK/Odp/OdpEventManager.cs Co-authored-by: Jae Kim <45045038+jaeopt@users.noreply.github.com> * Additional lock when emptying queue * Rollback select files * Requested code changes to model BatchEventProcessor * Remove unneeded test * Pull Request changes * Linter corrections * Bug fix * Pull request code review changes * Revert accidental file inclusion Co-authored-by: Sohail Hussain <mirza.sohailhussain@gmail.com> Co-authored-by: Jae Kim <45045038+jaeopt@users.noreply.github.com>
1 parent be1c9d8 commit 3eb53bd

14 files changed

+1385
-27
lines changed

OptimizelySDK.Tests/OdpTests/HttpClientTestUtil.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,33 +40,35 @@ public static HttpClient MakeHttpClient(HttpStatusCode statusCode,
4040
)
4141
{
4242
var response = new HttpResponseMessage(statusCode);
43-
43+
4444
if (!string.IsNullOrWhiteSpace(content))
4545
{
4646
response.Content = new StringContent(content);
4747
}
4848

4949
var mockedHandler = new Mock<HttpMessageHandler>();
50-
mockedHandler.Protected().Setup<Task<HttpResponseMessage>>(
50+
mockedHandler.Protected()
51+
.Setup<Task<HttpResponseMessage>>(
5152
"SendAsync",
5253
ItExpr.IsAny<HttpRequestMessage>(),
53-
ItExpr.IsAny<CancellationToken>()).
54-
ReturnsAsync(response);
54+
ItExpr.IsAny<CancellationToken>())
55+
.ReturnsAsync(response);
5556
return new HttpClient(mockedHandler.Object);
5657
}
57-
58+
5859
/// <summary>
5960
/// Create an HttpClient instance that will timeout for SendAsync calls
6061
/// </summary>
6162
/// <returns>HttpClient instance that throw TimeoutException</returns>
6263
public static HttpClient MakeHttpClientWithTimeout()
6364
{
6465
var mockedHandler = new Mock<HttpMessageHandler>();
65-
mockedHandler.Protected().Setup<Task<HttpResponseMessage>>(
66+
mockedHandler.Protected()
67+
.Setup<Task<HttpResponseMessage>>(
6668
"SendAsync",
6769
ItExpr.IsAny<HttpRequestMessage>(),
68-
ItExpr.IsAny<CancellationToken>()).
69-
Throws<TimeoutException>();
70+
ItExpr.IsAny<CancellationToken>())
71+
.Throws<TimeoutException>();
7072
return new HttpClient(mockedHandler.Object);
7173
}
7274
}

0 commit comments

Comments
 (0)