public void should_use_Warn_when_Warn() { externalLoggerMock = getMock(LogType.Warn, expectedText); var log = new ExternalLogAdapter(externalLoggerMock.Object); log.Warn(expectedText); externalLoggerMock.VerifyAll(); }
public void should_use_Info_when_Info() { externalLoggerMock = getMock(LogType.Info, expectedText); var log = new ExternalLogAdapter(externalLoggerMock.Object); log.Info(expectedText); externalLoggerMock.VerifyAll(); }
public void should_use_Error_when_Error() { externalLoggerMock = getMock(LogType.Error, expectedText); var log = new ExternalLogAdapter(externalLoggerMock.Object); log.Error(expectedText); externalLoggerMock.VerifyAll(); }
public void should_use_Debug_when_Debug() { externalLoggerMock = getMock(LogType.Debug, expectedText); var log = new ExternalLogAdapter(externalLoggerMock.Object); log.Debug(expectedText); externalLoggerMock.VerifyAll(); }
public void should_Not_use_Error_when_Info() { externalLoggerMock = new Mock <ILogger>(); externalLoggerMock.Setup(x => x.Enabled(It.Is <LogType>((lt) => lt == LogType.Info))).Returns(true).Verifiable(); externalLoggerMock.Setup(x => x.Log(It.Is <LogEntry>((le) => le.LogType == LogType.Info && le.Message == expectedText))).Verifiable(); IAppLogger log = new ExternalLogAdapter(externalLoggerMock.Object); log.Info(expectedText); externalLoggerMock.Verify(x => x.Enabled(It.Is <LogType>((lt) => lt == LogType.Info)), Times.Once); externalLoggerMock.Verify(x => x.Enabled(It.Is <LogType>((lt) => lt == LogType.Warn)), Times.Never); externalLoggerMock.Verify(x => x.Enabled(It.Is <LogType>((lt) => lt == LogType.Error)), Times.Never); externalLoggerMock.Verify(x => x.Enabled(It.Is <LogType>((lt) => lt == LogType.Debug)), Times.Never); externalLoggerMock.VerifyAll(); }
static SuperApplicationConsoleApp AppComposite() { IEncryptHelper crypto = new nope.Lib.Encryptor(); external.ILogger logger = new external.Logger(); // Not singleton IAppLogger myLogger = new ExternalLogAdapter(logger); IMessageSender sender = new FedExSender(crypto, myLogger); var basePriceRules = getBasePriceRules(); var extPriceRules = getExtendedPriceRules(); ICostCalculator calc = new CostCalculator(basePriceRules, extPriceRules, myLogger); ISendingMicroApp senderApp = new SuperSendingMicroApp(calc, sender, myLogger); IConsole writer = new ConsoleWriter(); return(new SuperApplicationConsoleApp(senderApp, writer)); }