public async Task OptOut_WhenMoreThanThreeFailures_ReturnsFalse() { // Arrange var httpHandler = new FakeHttpMessageHandler(_ => throw new Exception()); var client = new TelemetryClient(httpHandler, 3, TimeSpan.FromMilliseconds(1)); // Act var result = await client.OptOutAsync(new TelemetryPayload()); // Assert result.Should().BeFalse(); }
public async Task OptOut_WhenSuccess_ReturnsTrue() { // Arrange var response = new HttpResponseMessage(System.Net.HttpStatusCode.Created); var httpHandler = new FakeHttpMessageHandler(_ => response); var client = new TelemetryClient(httpHandler); // Act var result = await client.OptOutAsync(new TelemetryPayload()); // Assert result.Should().BeTrue(); }