public void GetCallerName_FromTestMethod_ShouldReturnThisMethodName()
        {
            DefaultConsoleApplicationLoggerImplementation logger = new DefaultConsoleApplicationLoggerImplementation();

            MethodBase returnValue = logger.GetCallerName();

            Assert.AreEqual("GetCallerName_FromTestMethod_ShouldReturnThisMethodName", returnValue.Name);
        }
        public void BuildDateTimeString_FromDateTimeNow_ShouldMatchGivenPattern()
        {
            DefaultConsoleApplicationLoggerImplementation logger = new DefaultConsoleApplicationLoggerImplementation();

            Regex pattern = new Regex("\\d{2}-\\d{2}-\\d{4} \\d{2}:\\d{2}:\\d{2}");

            string builtDateTime = logger.BuildDateTimeString();

            Console.WriteLine(builtDateTime);

            Assert.IsTrue(pattern.IsMatch(builtDateTime));
        }
        public void GetCallerDepth_FromTestMethod_ShouldReturnIntValueRepresentingThisMethodsCallStack()
        {
            DefaultConsoleApplicationLoggerImplementation logger = new DefaultConsoleApplicationLoggerImplementation();

            StackTrace stackTrace = new StackTrace();

            int expectedValue = stackTrace.GetFrames().Length;
            int returnValue   = logger.GetCallerDepth();

            Assert.AreEqual(expectedValue,
                            returnValue);
        }
 private int GetCallerDepthWrapper(int stackNumber, DefaultConsoleApplicationLoggerImplementation logger)
 {
     return(logger.GetCallerDepth(stackNumber));
 }
 private MethodBase GetCallerNameWrapper(int stackNumber, DefaultConsoleApplicationLoggerImplementation logger)
 {
     return(logger.GetCallerName(stackNumber));
 }
        public void WriteDebug_Test_ShouldPrintThisMessagesName()
        {
            DefaultConsoleApplicationLoggerImplementation logger = new DefaultConsoleApplicationLoggerImplementation();

            logger.WriteDebug("This is a test method");
        }