Exemplo n.º 1
0
        public void Wraptest_WhenLongLine_ThenBreakAtSpaceOrLineLength()
        {
            string wrapped = WordWrapper.Wrap("word word word", 8);

            Assert.AreEqual("word\nword\nword", wrapped);
        }
Exemplo n.º 2
0
        public void Wraptest_WhenLineShorterThanMax_ThenWrappedLineSame()
        {
            string wrapped = WordWrapper.Wrap("word", 5);

            Assert.AreEqual("word", wrapped);
        }
Exemplo n.º 3
0
        public void Wraptest_WhenLineLengthAtLetter_ThenWrapAtFirstSpaceLeftOfLineLength()
        {
            string wrapped = WordWrapper.Wrap("word word word", 12);

            Assert.AreEqual("word word\nword", wrapped);
        }
Exemplo n.º 4
0
        public void WrapTest_WhenVeryLongWord_ThenBreakAtLineLengthAnyway()
        {
            string wrapped = WordWrapper.Wrap("texttext text", 4);

            Assert.AreEqual("text\ntext\ntext", wrapped);
        }
Exemplo n.º 5
0
        public void Wraptest_WhenInEmpty_ThenOutEmpty()
        {
            string wrapped = WordWrapper.Wrap("", 2);

            Assert.AreEqual("", wrapped);
        }
Exemplo n.º 6
0
        public void WrapTest_WhenSpaceAtLineLenght_ThenBreakAtSpace()
        {
            string wrapped = WordWrapper.Wrap("text text text", 10);

            Assert.AreEqual("text text\ntext", wrapped, "wrap at Space and Linelength not working");
        }
Exemplo n.º 7
0
        public void WrapTest_WhenSpace2BeforeLineLength_ThenBreakBeforeSpace()
        {
            string wrapped = WordWrapper.Wrap("text text text", 11);

            Assert.AreEqual("text text\ntext", wrapped);
        }
Exemplo n.º 8
0
 public void WrapTest_WhenEmpty_ThenReturnEmpty()
 {
     Assert.AreEqual("", WordWrapper.Wrap("", 10), "empty string not properly wrapped");
 }
Exemplo n.º 9
0
 public void WrapTest_WhenShorterThanLine_ThenReturnLineUnchanged()
 {
     Assert.AreEqual("Text", WordWrapper.Wrap("Text", 10), "short string needs no wrapping");
 }
Exemplo n.º 10
0
        public void Wrap_ShouldReturnStringWithLineBreaks(string input, int columnLength, string expectedResult)
        {
            var result = WordWrapper.Wrap(input, columnLength);

            result.Should().Be(expectedResult);
        }
Exemplo n.º 11
0
 public void WrapTest_WhenLineWithSpaceAfterLineMax_ThenBreakAtLastSpace()
 {
     Assert.AreEqual("word word\nword", WordWrapper.Wrap("word word word", 9));
     Assert.AreEqual("word word\nword", WordWrapper.Wrap("word word word", 11));
     Assert.AreEqual("word\nword\nword", WordWrapper.Wrap("word word word", 8));
 }
Exemplo n.º 12
0
 public void WrapTest_WhenLineWithSpace_ThenBreakAtLastSpace()
 {
     Assert.AreEqual("word word\nword", WordWrapper.Wrap("word word word", 10));
 }
Exemplo n.º 13
0
 public void WrapTest_WhenLongLineNoSpace_ThenNoBreakAtLineLength()
 {
     Assert.AreEqual("longw\nord", WordWrapper.Wrap("longword", 5));
     Assert.AreEqual("word\nword\nword", WordWrapper.Wrap("wordwordword", 4));
 }
Exemplo n.º 14
0
 public void WrapTest_WhenShortLine_ThenNoBreak()
 {
     Assert.AreEqual("", WordWrapper.Wrap("", 5));
     Assert.AreEqual("word", WordWrapper.Wrap("word", 5));
 }