Esempio n. 1
0
        public void GivenUnhandledExceptionTypes_WhenHandleExpection_ThenNoMetricLoggedAndFalseReturned_Test(Type exType)
        {
            var log = Substitute.For <ILogger>();
            var ex  = Activator.CreateInstance(exType) as Exception;

            var exProcessor = new ExceptionTelemetryProcessor();
            var handled     = exProcessor.HandleException(ex, log);

            Assert.False(handled);

            log.DidNotReceiveWithAnyArgs().LogMetric(null, default(double));
        }
        public void GivenHandledExceptionTypes_WhenHandleExpection_ThenMetricLoggedAndTrueReturned_Test(System.Type exType)
        {
            var log = Substitute.For <ITelemetryLogger>();
            var ex  = Activator.CreateInstance(exType) as Exception;

            var exProcessor = new ExceptionTelemetryProcessor();
            var handled     = exProcessor.HandleException(ex, log, ConnectorOperation.FHIRConversion);

            Assert.True(handled);

            log.ReceivedWithAnyArgs(1).LogMetric(null, default(double));
        }