public void CallbackLoggerTest(LogLevel level) { MsalLogger logger = CreateLogger(level); 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>(), false)).Do(x => counter++); logger.Always(TestConstants.TestMessage); Assert.AreEqual(validationCounter, counter); _callback.Received().Invoke(Arg.Is((LogLevel)validationCounter - 2), Arg.Any <string>(), Arg.Is(false)); incrementCounter.Invoke(); _callback.When(x => x(LogLevel.Error, Arg.Any <string>(), false)).Do(x => counter++); logger.Error(TestConstants.TestMessage); Assert.AreEqual(validationCounter, counter); _callback.Received().Invoke(Arg.Is((LogLevel)validationCounter - 2), Arg.Any <string>(), Arg.Is(false)); incrementCounter.Invoke(); _callback.When(x => x(LogLevel.Warning, Arg.Any <string>(), false)).Do(x => counter++); logger.Warning(TestConstants.TestMessage); Assert.AreEqual(validationCounter, counter); _callback.Received().Invoke(Arg.Is((LogLevel)validationCounter - 2), Arg.Any <string>(), Arg.Is(false)); incrementCounter.Invoke(); _callback.When(x => x(LogLevel.Info, Arg.Any <string>(), false)).Do(x => counter++); logger.Info(TestConstants.TestMessage); Assert.AreEqual(validationCounter, counter); incrementCounter.Invoke(); _callback.When(x => x(LogLevel.Verbose, Arg.Any <string>(), false)).Do(x => counter++); logger.Verbose(TestConstants.TestMessage); Assert.AreEqual(validationCounter, counter); }