From 6fd707314b93ae05fb93cb66defe1079b280a611 Mon Sep 17 00:00:00 2001 From: Shawn Date: Sun, 16 Feb 2014 23:24:30 -0800 Subject: [PATCH 1/4] Removed vestigial IDE extension settings At one time Bellevue College used an extension to automatically increment version numbers on build. The extension is no longer in use, but its settings have persisted in the project files. --- CtcApi.Ods/OdsApi.Tests/Test.CtcApi.Ods.csproj | 5 ----- Test.CtcApi/Test.CtcApi.csproj | 5 ----- 2 files changed, 10 deletions(-) diff --git a/CtcApi.Ods/OdsApi.Tests/Test.CtcApi.Ods.csproj b/CtcApi.Ods/OdsApi.Tests/Test.CtcApi.Ods.csproj index 9453fd3..a0d399c 100644 --- a/CtcApi.Ods/OdsApi.Tests/Test.CtcApi.Ods.csproj +++ b/CtcApi.Ods/OdsApi.Tests/Test.CtcApi.Ods.csproj @@ -169,9 +169,4 @@ if exist $(ProjectDir)ConnectionStrings.config xcopy /y $(ProjectDir)ConnectionStrings.config $(OutDir) if exist $(ProjectDir)AppSettings.config xcopy /y $(ProjectDir)AppSettings.config $(OutDir) - - - - - \ No newline at end of file diff --git a/Test.CtcApi/Test.CtcApi.csproj b/Test.CtcApi/Test.CtcApi.csproj index f003b9b..a27cb67 100644 --- a/Test.CtcApi/Test.CtcApi.csproj +++ b/Test.CtcApi/Test.CtcApi.csproj @@ -119,11 +119,6 @@ - - - - - - - - - - \ No newline at end of file diff --git a/CtcApi/packages.config b/CtcApi/packages.config index 78ac149..284e56a 100644 --- a/CtcApi/packages.config +++ b/CtcApi/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file diff --git a/Test.CtcApi/Test.CtcApi.csproj b/Test.CtcApi/Test.CtcApi.csproj index a27cb67..15b9584 100644 --- a/Test.CtcApi/Test.CtcApi.csproj +++ b/Test.CtcApi/Test.CtcApi.csproj @@ -68,9 +68,32 @@ - + + ..\packages\Mvc3Assemblies.0.1.0\lib\System.Web.Helpers.dll + + + ..\packages\Mvc3Assemblies.0.1.0\lib\System.Web.Mvc.dll + + + ..\packages\Mvc3Assemblies.0.1.0\lib\System.Web.Razor.dll + + + ..\packages\Mvc3Assemblies.0.1.0\lib\System.Web.WebPages.dll + + + ..\packages\Mvc3Assemblies.0.1.0\lib\System.Web.WebPages.Deployment.dll + + + ..\packages\Mvc3Assemblies.0.1.0\lib\System.Web.WebPages.Razor.dll + + + ..\packages\Mvc3Assemblies.0.1.0\lib\WebMatrix.Data.dll + + + ..\packages\Mvc3Assemblies.0.1.0\lib\WebMatrix.WebData.dll + @@ -95,6 +118,7 @@ + diff --git a/Test.CtcApi/packages.config b/Test.CtcApi/packages.config new file mode 100644 index 0000000..f5cef38 --- /dev/null +++ b/Test.CtcApi/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file From 1c183c0701e1dd79605f8cde4e7336ce9ee42d58 Mon Sep 17 00:00:00 2001 From: Shawn Date: Thu, 20 Feb 2014 23:47:52 -0800 Subject: [PATCH 4/4] Complete test suite for LogElapsed --- CtcApi/Diagnostics/LogElapsed.cs | 3 +- Test.CtcApi/LogElapsedTest.cs | 125 +++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+), 2 deletions(-) diff --git a/CtcApi/Diagnostics/LogElapsed.cs b/CtcApi/Diagnostics/LogElapsed.cs index ecd6ff4..b216091 100644 --- a/CtcApi/Diagnostics/LogElapsed.cs +++ b/CtcApi/Diagnostics/LogElapsed.cs @@ -98,8 +98,7 @@ private void WriteToLog(LogLevel level, string message) _log.Trace(message); break; default: - _log.Warn( - "Unsupported LogLevel specified. Supported levels are Info, Debug and Trace. Falling back to Trace."); + _log.Warn("Unsupported LogLevel specified. Supported levels are Info, Debug and Trace. Falling back to Trace."); _log.Trace(message); break; } diff --git a/Test.CtcApi/LogElapsedTest.cs b/Test.CtcApi/LogElapsedTest.cs index bd898dd..be1128f 100644 --- a/Test.CtcApi/LogElapsedTest.cs +++ b/Test.CtcApi/LogElapsedTest.cs @@ -13,6 +13,8 @@ //You should have received a copy of the GNU Lesser General Public //License and GNU General Public License along with this program. //If not, see . + +using System; using Common.Logging; using Common.Logging.Simple; using CtcApi.Diagnostics; @@ -82,6 +84,129 @@ public void With_Label() AssertLastLogMessageStartsWith("Elapsed TIME for Testing label:"); } + [TestMethod] + public void With_Label_StartLevel() + { + using (new LogElapsed("Testing label", LogLevel.Debug)) + { + AssertLogEventCount(1); + AssertLastLogLeven(LogLevel.Debug); + AssertLastLogMessageStartsWith("Starting TIMER for: Testing label"); + } + + AssertLogEventCount(2); + AssertLastLogLeven(DEFAULT_LOG_LEVEL); + AssertLastLogMessageStartsWith("Elapsed TIME for Testing label:"); + } + + [TestMethod] + public void With_Label_StartLevel_EndLevel() + { + using (new LogElapsed("Testing label", LogLevel.Debug, LogLevel.Info)) + { + AssertLogEventCount(1); + AssertLastLogLeven(LogLevel.Debug); + AssertLastLogMessageStartsWith("Starting TIMER for: Testing label"); + } + + AssertLogEventCount(2); + AssertLastLogLeven(LogLevel.Info); + AssertLastLogMessageStartsWith("Elapsed TIME for Testing label:"); + } + + [TestMethod] + public void With_StartLevel_EndLevel() + { + using (new LogElapsed(startLevel: LogLevel.Info, finishLevel: LogLevel.Debug)) + { + AssertLogEventCount(1); + AssertLastLogLeven(LogLevel.Info); + AssertLastLogMessageStartsWith("Starting TIMER:"); + } + + AssertLogEventCount(2); + AssertLastLogLeven(LogLevel.Debug); + AssertLastLogMessageStartsWith("Elapsed TIME:"); + } + + [TestMethod] + public void With_EndLevel() + { + using (new LogElapsed(finishLevel: LogLevel.Debug)) + { + AssertLogEventCount(1); + AssertLastLogLeven(DEFAULT_LOG_LEVEL); + AssertLastLogMessageStartsWith("Starting TIMER:"); + } + + AssertLogEventCount(2); + AssertLastLogLeven(LogLevel.Debug); + AssertLastLogMessageStartsWith("Elapsed TIME:"); + } + + [TestMethod] + public void With_Label_EndLevel() + { + using (new LogElapsed("Testing label", finishLevel: LogLevel.Debug)) + { + AssertLogEventCount(1); + AssertLastLogLeven(DEFAULT_LOG_LEVEL); + AssertLastLogMessageStartsWith("Starting TIMER for: Testing label"); + } + + AssertLogEventCount(2); + AssertLastLogLeven(LogLevel.Debug); + AssertLastLogMessageStartsWith("Elapsed TIME for Testing label:"); + } + + [TestMethod] + public void InvalidStartLevels() + { + foreach (LogLevel level in new[] {LogLevel.Fatal, LogLevel.Error, LogLevel.Warn}) + { + _adapter.Clear(); + Console.Out.Write("Testing LogLevel: {0}...\n", level.ToString("F")); + + using (new LogElapsed(startLevel: level)) + { + // should issue warning... + AssertLogEventCount(2); + Assert.AreEqual(LogLevel.Warn, _adapter.LoggerEvents[0].Level); + // ...then fall back to default + AssertLastLogLeven(DEFAULT_LOG_LEVEL); + AssertLastLogMessageStartsWith("Starting TIMER:"); + } + + AssertLogEventCount(3); + AssertLastLogLeven(DEFAULT_LOG_LEVEL); + AssertLastLogMessageStartsWith("Elapsed TIME:"); + } + } + + [TestMethod] + public void InvalidEndLevels() + { + foreach (LogLevel level in new[] {LogLevel.Fatal, LogLevel.Error, LogLevel.Warn}) + { + _adapter.Clear(); + Console.Out.Write("Testing LogLevel: {0}...\n", level.ToString("F")); + + using (new LogElapsed(finishLevel: level)) + { + AssertLogEventCount(1); + AssertLastLogLeven(DEFAULT_LOG_LEVEL); + AssertLastLogMessageStartsWith("Starting TIMER:"); + } + + AssertLogEventCount(3); + // should issue warning... + Assert.AreEqual(LogLevel.Warn, _adapter.LoggerEvents[1].Level); + // ...then fall back to default + AssertLastLogLeven(DEFAULT_LOG_LEVEL); + AssertLastLogMessageStartsWith("Elapsed TIME:"); + } + } + #endregion #region Private methods