public async Task WhenInsertNewRequestThenPostToVisitApi() { var service = new Neo4JService(settings, client, logger); await service.InsertNewRequest(A.Fake <HttpRequest>()); A.CallTo(() => fakeHttpRequestSender.Send(A <HttpRequestMessage> .Ignored)).MustHaveHappened(); }
public async Task WhenRequestNullThenDoNotCallVisitService() { var service = new Neo4JService(settings, client, logger); await service.InsertNewRequest(null); A.CallTo(() => logger.Log(LogLevel.Warning, A <Exception> .Ignored, A <string> .Ignored)) .MustHaveHappened(1, Times.Exactly); A.CallTo(() => fakeHttpRequestSender.Send(A <HttpRequestMessage> .Ignored)).MustNotHaveHappened(); }
public async Task WhenInsertNewRequestFailsThenLogError() { A.CallTo(() => fakeHttpRequestSender.Send(A <HttpRequestMessage> .Ignored)).Throws(new Exception()); var service = new Neo4JService(settings, client, logger); await service.InsertNewRequest(A.Fake <HttpRequest>()); A.CallTo(() => logger.Log(LogLevel.Warning, A <Exception> .Ignored, A <string> .Ignored)) .MustHaveHappened(1, Times.Exactly); A.CallTo(() => fakeHttpRequestSender.Send(A <HttpRequestMessage> .Ignored)).MustHaveHappened(); }
public async Task WhenInsertNewRequestAndSendDateIsFalseThenDoNotPostToVisitApi() { var options = Options.Create(new Neo4JSettings { SendData = false, }); var service = new Neo4JService(options, client, logger); await service.InsertNewRequest(A.Fake <HttpRequest>()); A.CallTo(() => fakeHttpRequestSender.Send(A <HttpRequestMessage> .Ignored)).MustNotHaveHappened(); }