public void findshortest() { Sort sort = new Sort(); Sorted sorted = new Sorted(); sorted = sort.shortest("A cow jumped over the moon"); Assert.Equal("A", sorted.Word); Assert.Equal(1, sorted.Length); }
public void multipleSpaceBetweenWords() { Sort sort = new Sort(); Sorted sorted = new Sorted(); sorted = sort.shortest("The cow jumped over the moon"); Assert.Equal("", sorted.Word); Assert.Equal(0, sorted.Length); }
public void apostrophesIncludedInWordLength() { Sort sort = new Sort(); Sorted sorted = new Sorted(); sorted = sort.shortest("A' cow didn't jump over the moon"); Assert.Equal("A'", sorted.Word); Assert.Equal(2, sorted.Length); }
public void numbersTreatedAsWords() { Sort sort = new Sort(); Sorted sorted = new Sorted(); sorted = sort.shortest("1 cow jumped over the moon"); Assert.Equal("1", sorted.Word); Assert.Equal(1, sorted.Length); }
public void multipleWordsOfshortestLength() { Sort sort = new Sort(); Sorted sorted = new Sorted(); sorted = sort.shortest("The cow jumped over the moon"); Assert.Equal("The", sorted.Word); Assert.Equal(3, sorted.Length); }
public void underScoresIncludedInWordLength() { Sort sort = new Sort(); Sorted sorted = new Sorted(); sorted = sort.shortest("A_ cow jumped over the new_moon"); Assert.Equal("A_", sorted.Word); Assert.Equal(2, sorted.Length); }
public void findLongest() { Sort sort = new Sort(); Sorted sorted = new Sorted(); sorted = sort.longest("The cow jumped over the moon"); Assert.Equal("jumped", sorted.Word); Assert.Equal(6, sorted.Length); }
public void emptyString() { Sort sort = new Sort(); Sorted sorted = new Sorted(); sorted = sort.shortest(""); Assert.Equal("", sorted.Word); Assert.Equal(0, sorted.Length); }
public void numbersTreatedAsWords() { Sort sort = new Sort(); Sorted sorted = new Sorted(); sorted = sort.longest("1234567 cows jumped over the moon"); Assert.Equal("1234567", sorted.Word); Assert.Equal(7, sorted.Length); }
public void apostrophesIncludedInWordLength() { Sort sort = new Sort(); Sorted sorted = new Sorted(); sorted = sort.longest("The cow didn't jump over the moon"); Assert.Equal("didn't", sorted.Word); Assert.Equal(6, sorted.Length); }
public void multipleWordsOfLongestLength() { Sort sort = new Sort(); Sorted sorted = new Sorted(); sorted = sort.longest("The better cow jumped over the moon"); Assert.Equal("better", sorted.Word); Assert.Equal(6, sorted.Length); }
public Sorted longest(string sentence) { string[] wordList = splitter(sentence); var biggest = wordList.OrderByDescending(n => n.Length).First(); Sorted sorted = new Sorted(); sorted.Word = biggest; sorted.Length = biggest.Length; return(sorted); }
public Sorted shortest(string sentence) { string[] wordList = splitter(sentence); var smallest = wordList.OrderBy(n => n.Length).First(); Sorted sorted = new Sorted(); sorted.Word = smallest; sorted.Length = smallest.Length; return(sorted); }