public void ShouldWrapProperly()
        {
            var expected = new StringBuilder().AppendLine("123 123")
                                              .AppendLine("123")
                                              .AppendLine()
                                              .AppendLine("12341234")
                                              .AppendLine("1234")
                                              .AppendLine()
                                              .AppendLine("1234567")
                                              .AppendLine("1234567")
                                              .AppendLine()
                                              .AppendLine("abcdefghij")
                                              .AppendLine("klmnopqrst")
                                              .AppendLine("uvwxyz")
                                              .ToString();

            var writer = new TestWriter(10);

            writer.WriteLine("123 123 123");
            writer.WriteLine();

            writer.Write("1234");
            writer.Write("1234");
            writer.Write("1234");
            writer.WriteLine();
            writer.WriteLine();

            writer.WriteLine("1234567 \r\n 1234567");
            writer.WriteLine();

            writer.WriteLine("abcdefghijklmnopqrstuvwxyz");

            writer.ToString().ShouldBe(expected);
        }
        public void ShouldIndentProperly()
        {
            var expected = new StringBuilder().AppendLine("header-1")
                                              .AppendLine("  header-1.1 foo")
                                              .AppendLine("    item-1.1.1")
                                              .AppendLine("    item-1.1.2")
                                              .AppendLine("  header-1.2")
                                              .ToString();

            var writer = new TestWriter();
            writer.WriteLine("header-1");
            using (writer.Indent(2))
            {
                writer.Write("header-1.1");
                using (writer.Indent(2))
                {
                    writer.WriteLine(" foo");
                    writer.WriteLine("item-1.1.1");
                    writer.WriteLine("item-1.1.2");
                }
                writer.WriteLine("header-1.2");
            }

            writer.ToString().ShouldBe(expected);
        }
        public void ShouldBeAbleToUseNonBreakingSpaces()
        {
            var expected = new StringBuilder().AppendLine("1234")
                                              .AppendLine("1234 1234")
                                              .AppendLine("1234")
                                              .ToString();

            var writer = new TestWriter(10);

            writer.Write("1234");
            writer.Write("1234 1234".ReplaceSpaceWithNonBreakingSpace());
            writer.WriteLine("1234");

            writer.ToString().ShouldBe(expected);
        }
        public void ConfiguredArgShouldHaveCorrectConfiguration()
        {
            var builder = new CmdLineInputDefinitionBuilder();

            builder.Arg("foo")
                   .IsOptional()
                   .IsParams()
                   .Description("description")
                   .DisplayName("displayName");

            var definition = builder.Definition.Args.First();
            definition.Name.ShouldBe("foo");
            definition.IsOptional.ShouldBe(true);
            definition.IsParams.ShouldBe(true);
            definition.DisplayName.ShouldBe("displayName");

            var writer = new TestWriter();
            definition.DescriptionWriter(definition, writer, 0);
            writer.ToString().ShouldBe("description" + Environment.NewLine);
        }
        public void ConfiguredOptionValueShouldHaveCorrectConfiguration()
        {
            var builder = new CmdLineInputDefinitionBuilder();

            builder.Option("option")
                   .Value("value", x => x.IsOptional().IsParams().Description("description").DisplayName("displayName"));

            CmdLineOptionDefinition optionDefinition;
            builder.TryGetOption("option", out optionDefinition);
            var definition = optionDefinition.Values.First();
            definition.Name.ShouldBe("value");
            definition.IsOptional.ShouldBe(true);
            definition.IsParams.ShouldBe(true);
            definition.DisplayName.ShouldBe("displayName");

            var writer = new TestWriter();
            definition.DescriptionWriter(definition, writer, 0);
            writer.ToString().ShouldBe("description" + Environment.NewLine);
        }
        public void ConfiguredOptionShouldHaveCorrectConfiguration()
        {
            var builder = new CmdLineInputDefinitionBuilder();

            builder.Option("noValueOption")
                   .AllowMultiple()
                   .IsRequired()
                   .Description("description")
                   .ShortCut("nvo");

            CmdLineOptionDefinition definition;
            builder.TryGetOption("noValueOption", out definition);
            definition.Name.ShouldBe("noValueOption");
            definition.AllowMultiple.ShouldBe(true);
            definition.IsRequired.ShouldBe(true);
            definition.Shortcut.ShouldBe("nvo");

            var writer = new TestWriter();
            definition.DescriptionWriter(definition, writer, 0);
            writer.ToString().ShouldBe("description" + Environment.NewLine);
        }