public void Ensure_DescriptionText_Can_Be_Set()
		{
			var formatter = new CommandLineOptionFormatter();

			const string expected = "my description text";

			formatter.DescriptionText = expected;

			Assert.AreEqual(expected, formatter.DescriptionText);
		}
		public void Ensure_NoOptionsText_Can_Be_Set()
		{
			var formatter = new CommandLineOptionFormatter();

			const string expected = "no Options setup text";

			formatter.NoOptionsText = expected;

			Assert.AreEqual(expected, formatter.NoOptionsText);
		}
        public void Ensure_Format_Returns_Expected_String()
        {
            var formatter = new CommandLineOptionFormatter();

            // expected:
            //  Short1          Description1
            //  Short2:Long2    Description2

            var mockOption1 = CreateMockOption("Short1", null, "Description1");
            var mockOption2 = CreateMockOption("Short2", "Long2", "Description2");

            var expectedSb = new StringBuilder();
            expectedSb.AppendLine();
            expectedSb.AppendFormat(CultureInfo.CurrentUICulture, CommandLineOptionFormatter.TextFormat, mockOption1.ShortName, mockOption1.Description);
            expectedSb.AppendFormat(CultureInfo.CurrentUICulture, CommandLineOptionFormatter.TextFormat, mockOption2.ShortName + ":" + mockOption2.LongName, mockOption2.Description);

            var expected = expectedSb.ToString();
            var actual = formatter.Format(new[] { mockOption1, mockOption2 });

            Assert.AreEqual(expected, actual, "Formatter returned unexpected string");
        }
		public void Ensure_Header_Can_Be_Set()
		{
			var formatter = new CommandLineOptionFormatter();

			const string expected = "my custom header";

			formatter.Header = expected;

			Assert.AreEqual(expected, formatter.Header);   
		}
		public void Ensure_NoOptionsText_Returned_If_No_options_Have_Been_Setup()
		{
			var formatter = new CommandLineOptionFormatter();

			var actual = formatter.Format(new ICommandLineOption[0]);

			Assert.AreEqual(formatter.NoOptionsText, actual);
		}
		public void Ensure_Header_Is_Displayed_If_One_Is_Set()
		{
			var formatter = new CommandLineOptionFormatter();

			// expected:
			//  my custom header
			//
			//  Short1          Description1
			//  Short2:Long2    Description2 

			const string expectedHeader = "my custom header";

			formatter.Header = expectedHeader;

			var mockOption1 = CreateMockOption("Short1", null, "Description1");
			var mockOption2 = CreateMockOption("Short2", "Long2", "Description2");

			var expectedSb = new StringBuilder();
			expectedSb.AppendLine();
			expectedSb.AppendLine(expectedHeader);
			expectedSb.AppendLine();
			expectedSb.AppendFormat(CultureInfo.CurrentUICulture, CommandLineOptionFormatter.TextFormat, mockOption1.ShortName, mockOption1.Description);
			expectedSb.AppendFormat(CultureInfo.CurrentUICulture, CommandLineOptionFormatter.TextFormat, mockOption2.ShortName + ":" + mockOption2.LongName, mockOption2.Description);

			var expected = expectedSb.ToString();
			var actual = formatter.Format(new[] { mockOption1, mockOption2 });

			Assert.AreEqual(expected, actual, "Formatter returned unexpected string");
		}
		public void Ensure_Format_Returns_Expected_String()
		{
			var formatter = new CommandLineOptionFormatter();

			// expected:
			//  Short1          Description1
			//  Short2:Long2    Description2 

			var mockOptionA = CreateMockOption("a", "aaa", "a-description");
			var mockOptionB = CreateMockOption("b", null, "b-description1");
			var mockOptionC = CreateMockOption(null, "ccc", "c-description");

			var expectedSb = new StringBuilder();
			expectedSb.AppendLine();
			expectedSb.AppendFormat(CultureInfo.CurrentUICulture, CommandLineOptionFormatter.TextFormat, mockOptionA.ShortName + ":" + mockOptionA.LongName, mockOptionA.Description);
			expectedSb.AppendFormat(CultureInfo.CurrentUICulture, CommandLineOptionFormatter.TextFormat, mockOptionB.ShortName, mockOptionB.Description);
			expectedSb.AppendFormat(CultureInfo.CurrentUICulture, CommandLineOptionFormatter.TextFormat, mockOptionC.LongName, mockOptionC.Description);

			var expected = expectedSb.ToString();
			var actual = formatter.Format(new[] { mockOptionB, mockOptionA, mockOptionC });

			Assert.AreEqual(expected, actual, "Formatter returned unexpected string");
		}
		public void Ensure_Cannot_Specify_Null_options_Param()
		{
			var formatter = new CommandLineOptionFormatter();

			formatter.Format(null);
		}