Index: Migration/Console/test/Migration.Console.Test/ConsoleHelperTest.cs =================================================================== diff -u -rac9fc776779eb7f111ca7d9911d4684d47818891 -r0930763dbd895350070e8075dc9d7ba1bd89cf0f --- Migration/Console/test/Migration.Console.Test/ConsoleHelperTest.cs (.../ConsoleHelperTest.cs) (revision ac9fc776779eb7f111ca7d9911d4684d47818891) +++ Migration/Console/test/Migration.Console.Test/ConsoleHelperTest.cs (.../ConsoleHelperTest.cs) (revision 0930763dbd895350070e8075dc9d7ba1bd89cf0f) @@ -120,5 +120,87 @@ // Assert Assert.Throws(call); } + + [Test] + public void WriteCommandDescriptionLine_StringNull_ThrowsArgumentNullException() + { + // Setup + const string args = "an argument"; + + // Call + TestDelegate call = () => ConsoleHelper.WriteCommandDescriptionLine(null, args); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("format", paramName); + } + + [Test] + public void WriteCommandDescriptionLine_ArgsNull_ThrowsArgumentNullException() + { + // Setup + const string writeLine = "this is an error line with {0}"; + + // Call + TestDelegate call = () => ConsoleHelper.WriteCommandDescriptionLine(writeLine, null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("args", paramName); + } + + [Test] + public void WriteCommandDescriptionLine_StringAndParamArgs_WritesExpectedLine() + { + // Setup + const string writeLine = "this is an error line with {0}"; + const string args = "an argument"; + string consoleText; + + // Call + using (var consoleOutput = new ConsoleOutput()) + { + ConsoleHelper.WriteCommandDescriptionLine(writeLine, args); + consoleText = consoleOutput.GetConsoleOutput(); + } + + // Assert + var expectedText = string.Concat(" ", string.Format(writeLine, args), + Environment.NewLine, Environment.NewLine); + Assert.AreEqual(expectedText, consoleText); + } + + [Test] + public void WriteCommandDescriptionLine_String_WritesExpectedLine() + { + // Setup + const string writeLine = "this is an error line"; + string consoleText; + + // Call + using (var consoleOutput = new ConsoleOutput()) + { + ConsoleHelper.WriteCommandDescriptionLine(writeLine); + consoleText = consoleOutput.GetConsoleOutput(); + } + + // Assert + var expectedText = string.Concat(" ", writeLine, Environment.NewLine, + Environment.NewLine); + Assert.AreEqual(expectedText, consoleText); + } + + [Test] + public void WriteCommandDescriptionLine_InvalidString_ThrowsFormatException() + { + // Setup + string invalidFormat = "{d}"; + + // Call + TestDelegate call = () => ConsoleHelper.WriteCommandDescriptionLine(invalidFormat, "ABC"); + + // Assert + Assert.Throws(call); + } } } \ No newline at end of file