Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute retry logic in Send() method even if exception is not of type WebException #25

Open
wants to merge 3 commits into
base: master
from
Open
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Add unit test to verify that a generic system error executes the same…

… retry logic as a WebException does.
  • Loading branch information
MikeMugu committed Apr 25, 2019
commit 24620dbd250459e4f3796fd5e1fe9688a725c9d1
@@ -92,6 +92,24 @@ public void RetriesSendWhenErrorOccurs()
"Generic send error should be retried");
}

[Fact]
public void RetriesSendWhenSystemErrorOccurs()
{
_webRequestMock.Setup(x => x.GetResponse())
.Throws(new OperationCanceledException("The operation was canceled."));

var config = new Config
{
MaxSendRetries = 3
};
var client = new LogglyClient(config);

client.Send(new[] { "test message" }, 1);

_webRequestMock.Verify(x => x.GetResponse(), Times.Exactly(config.MaxSendRetries + 1),
"Generic system error should be retried");
}

[Fact]
public void SendsCorrectData()
{
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.