public static Wrap ( string word, int wordLength ) : string | ||
word | string | |
wordLength | int | |
return | string |
public void CanWrapMultipleLine() { const string inputword = "Today is friday. \nLets go outside.\n Happy weekedn!"; const string expectedword = "Today\n is friday. \nLets go outside.\nHappy weekedn!"; var actualresult = (WordWrap.Wrap(inputword, 5)); Assert.That(expectedword, Is.EqualTo(actualresult), string.Format("result of entered word [{0}] is [{1}] but it should be [{2}]", inputword, actualresult, expectedword)); }
public void CanTestNewLineCharacter() { Assert.That("\n", Is.EqualTo(WordWrap.Wrap("\n", 1))); Assert.That("\nLet's\nGo\noutside.", Is.EqualTo(WordWrap.Wrap("\nLet's Go\noutside.", 5))); }
public void CanTestForNullWord() => Assert.That("", Is.EqualTo(WordWrap.Wrap(null, 5)));
public void CanTestForNullOrWhiteSpacesWord() { Assert.That("", Is.EqualTo(WordWrap.Wrap(null, 5))); Assert.That("", Is.EqualTo(WordWrap.Wrap(" ", 5))); }
public void CanWrapSingleLine() => Assert.That("Let's\nGo", Is.EqualTo(WordWrap.Wrap("Let's Go", 5)));