Exemple #1
0
        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();
        }
Exemple #2
0
        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();
        }
Exemple #3
0
        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();
        }
Exemple #4
0
        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();
        }