public void NullObfuscationServiceDoesNotThrowException() { var kisslogApi = new Mock <IPublicApi>(); kisslogApi.Setup(p => p.CreateRequestLog(It.IsAny <CreateRequestLogRequest>(), It.IsAny <IEnumerable <File> >())) .Returns(new ApiResult <RequestLog>()); var listener = new RequestLogsApiListener(new Application("organizationId", "applicationId"), kisslogApi.Object) { UseAsync = false, ObfuscationService = null }; FlushLogArgs flushLogArgs = CommonTestHelpers.Factory.CreateFlushLogArgs(); listener.OnFlush(flushLogArgs); }
public void UseAsyncIsEvaluated(bool useAsync) { bool createRequestLog = false; bool createRequestLogAsync = false; var kisslogApi = new Mock <IPublicApi>(); kisslogApi.Setup(p => p.CreateRequestLog(It.IsAny <CreateRequestLogRequest>(), It.IsAny <IEnumerable <File> >())).Callback(() => { createRequestLog = true; }) .Returns(new ApiResult <RequestLog>()); kisslogApi.Setup(p => p.CreateRequestLogAsync(It.IsAny <CreateRequestLogRequest>(), It.IsAny <IEnumerable <File> >())).Callback(() => { createRequestLogAsync = true; }) .Returns(Task.FromResult(new ApiResult <RequestLog>())); var listener = new RequestLogsApiListener(new Application("organizationId", "applicationId"), kisslogApi.Object) { UseAsync = useAsync }; FlushLogArgs flushLogArgs = CommonTestHelpers.Factory.CreateFlushLogArgs(); listener.OnFlush(flushLogArgs); if (useAsync == true) { Assert.IsFalse(createRequestLog); Assert.IsTrue(createRequestLogAsync); } else { Assert.IsTrue(createRequestLog); Assert.IsFalse(createRequestLogAsync); } }