public void PiiLogCallbackTest()
        {
            var logger = new Logger();
            var state  = new CallState(Guid.NewGuid());

            var obsoleteCallback = new TestObsoleteAdalLogCallback();

            LoggerCallbackHandler.Callback = obsoleteCallback;

            LoggerCallbackHandler.LogCallback = InitLogCallback();

            LoggerCallbackHandler.PiiLoggingEnabled = true;

            logger.ErrorPii(state, new Exception(Message));
            Assert.AreEqual(1, _piiErrorLogCount);
            Assert.AreEqual(0, _piiWarningLogCount);
            Assert.AreEqual(0, _piiInfoLogCount);
            Assert.AreEqual(0, _piiVerboseLogCount);

            logger.InformationPii(state, Message);
            Assert.AreEqual(1, _piiErrorLogCount);
            Assert.AreEqual(0, _piiWarningLogCount);
            Assert.AreEqual(1, _piiInfoLogCount);
            Assert.AreEqual(0, _piiVerboseLogCount);

            logger.VerbosePii(state, Message);
            Assert.AreEqual(1, _piiErrorLogCount);
            Assert.AreEqual(0, _piiWarningLogCount);
            Assert.AreEqual(1, _piiInfoLogCount);
            Assert.AreEqual(1, _piiVerboseLogCount);

            logger.WarningPii(state, Message);
            Assert.AreEqual(1, _piiErrorLogCount);
            Assert.AreEqual(1, _piiWarningLogCount);
            Assert.AreEqual(1, _piiInfoLogCount);
            Assert.AreEqual(1, _piiVerboseLogCount);

            // make sure no calls to Log with containsPii = false
            Assert.AreEqual(0, _errorLogCount);
            Assert.AreEqual(0, _warningLogCount);
            Assert.AreEqual(0, _infoLogCount);
            Assert.AreEqual(0, _verboseLogCount);

            // make sure no calls were done to ObsoleteAdalLogCallback
            Assert.AreEqual(0, obsoleteCallback.AllCallsCount);
        }
        public void ObsoleteAdalLogCallbackTest()
        {
            var logger = new Logger();
            var state  = new CallState(Guid.NewGuid());

            var obsoleteCallback = new TestObsoleteAdalLogCallback();

            LoggerCallbackHandler.Callback = obsoleteCallback;

            LoggerCallbackHandler.LogCallback = null;

            LoggerCallbackHandler.PiiLoggingEnabled = true;

            logger.ErrorPii(state, new Exception(Message));
            logger.InformationPii(state, Message);
            logger.VerbosePii(state, Message);
            logger.WarningPii(state, Message);

            // make sure no Pii are logged with ObsoleteAdalLogCallback
            Assert.AreEqual(0, obsoleteCallback.AllCallsCount);

            logger.Error(state, new Exception(Message));
            Assert.AreEqual(1, obsoleteCallback.ErrorLogCount);
            Assert.AreEqual(0, obsoleteCallback.WarningLogCount);
            Assert.AreEqual(0, obsoleteCallback.InfoLogCount);
            Assert.AreEqual(0, obsoleteCallback.VerboseLogCount);

            logger.Information(state, Message);
            Assert.AreEqual(1, obsoleteCallback.ErrorLogCount);
            Assert.AreEqual(0, obsoleteCallback.WarningLogCount);
            Assert.AreEqual(1, obsoleteCallback.InfoLogCount);
            Assert.AreEqual(0, obsoleteCallback.VerboseLogCount);

            logger.Verbose(state, Message);
            Assert.AreEqual(1, obsoleteCallback.ErrorLogCount);
            Assert.AreEqual(0, obsoleteCallback.WarningLogCount);
            Assert.AreEqual(1, obsoleteCallback.InfoLogCount);
            Assert.AreEqual(1, obsoleteCallback.VerboseLogCount);

            logger.Warning(state, Message);
            Assert.AreEqual(1, obsoleteCallback.ErrorLogCount);
            Assert.AreEqual(1, obsoleteCallback.WarningLogCount);
            Assert.AreEqual(1, obsoleteCallback.InfoLogCount);
            Assert.AreEqual(1, obsoleteCallback.VerboseLogCount);
        }