public void CallbackTestVerbosePii() { MsalLogger logger = new MsalLogger(Guid.Empty, null); var counter = 0; Logger.Level = LogLevel.Verbose; Logger.PiiLoggingEnabled = true; _callback.When(x => x(LogLevel.Error, Arg.Any <string>(), true)).Do(x => counter++); logger.ErrorPii(new ArgumentException("test message")); Assert.AreEqual(1, counter); _callback.When(x => x(LogLevel.Warning, Arg.Any <string>(), true)).Do(x => counter++); logger.WarningPii("test message", string.Empty); Assert.AreEqual(2, counter); _callback.When(x => x(LogLevel.Info, Arg.Any <string>(), true)).Do(x => counter++); logger.InfoPii("test message", string.Empty); Assert.AreEqual(3, counter); _callback.When(x => x(LogLevel.Verbose, Arg.Any <string>(), true)).Do(x => counter++); logger.VerbosePii("test message", string.Empty); Assert.AreEqual(4, counter); }
public void CallbackTestLoggersPii(LogLevel level) { MsalLogger logger = CreateLogger(level, true); var counter = 0; var validationCounter = 1; var levelToValidate = LogLevel.Always; Action incrementCounter = () => { if (level > levelToValidate) { validationCounter++; } levelToValidate++; }; _callback.When(x => x(LogLevel.Always, Arg.Any <string>(), true)).Do(x => counter++); logger.AlwaysPii(TestConstants.TestMessage, string.Empty); Assert.AreEqual(validationCounter, counter); incrementCounter.Invoke(); _callback.When(x => x(LogLevel.Error, Arg.Any <string>(), true)).Do(x => counter++); logger.ErrorPii(new ArgumentException(TestConstants.TestMessage)); Assert.AreEqual(validationCounter, counter); incrementCounter.Invoke(); _callback.When(x => x(LogLevel.Warning, Arg.Any <string>(), true)).Do(x => counter++); logger.WarningPii(TestConstants.TestMessage, string.Empty); Assert.AreEqual(validationCounter, counter); incrementCounter.Invoke(); _callback.When(x => x(LogLevel.Info, Arg.Any <string>(), true)).Do(x => counter++); logger.InfoPii(TestConstants.TestMessage, string.Empty); Assert.AreEqual(validationCounter, counter); incrementCounter.Invoke(); _callback.When(x => x(LogLevel.Verbose, Arg.Any <string>(), true)).Do(x => counter++); logger.VerbosePii(TestConstants.TestMessage, string.Empty); Assert.AreEqual(validationCounter, counter); }
public void CallbackTestVerbosePii() { MsalLogger logger = CreateLogger(LogLevel.Verbose, true); var counter = 0; _callback.When(x => x(LogLevel.Error, Arg.Any <string>(), true)).Do(x => counter++); logger.ErrorPii(new ArgumentException(TestConstants.TestMessage)); Assert.AreEqual(1, counter); _callback.When(x => x(LogLevel.Warning, Arg.Any <string>(), true)).Do(x => counter++); logger.WarningPii(TestConstants.TestMessage, string.Empty); Assert.AreEqual(2, counter); _callback.When(x => x(LogLevel.Info, Arg.Any <string>(), true)).Do(x => counter++); logger.InfoPii(TestConstants.TestMessage, string.Empty); Assert.AreEqual(3, counter); _callback.When(x => x(LogLevel.Verbose, Arg.Any <string>(), true)).Do(x => counter++); logger.VerbosePii(TestConstants.TestMessage, string.Empty); Assert.AreEqual(4, counter); }