public void InvalidNThrowsExceptionTest() { // Arrange var words = StringList("a"); var wordFrequencies = new WordFrequencies(words); var numToFind = 0; // Act wordFrequencies.GetNthMostOccurring(numToFind); }
public void OrderingSkipsValuesTest() { // Arrange var words = StringList("a", "a", "b", "b", "c"); var wordFrequencies = new WordFrequencies(words); var expected = StringList("c"); var numToFind = 3; // Act var actual = wordFrequencies.GetNthMostOccurring(numToFind); // Assert AssertListsAreEqual(expected, actual); }
public void TwoWordsSameOccurrencesAreSortedTest() { // Arrange var words = StringList("a", "a", "b", "b"); var wordFrequencies = new WordFrequencies(words); var expected = StringList("a", "b"); var numToFind = 1; // Act var actual = wordFrequencies.GetNthMostOccurring(numToFind); // Assert AssertListsAreEqual(expected, actual); }
public void SingleWordWithMultipleOccurrencesTest() { // Arrange var words = StringList("a", "a"); var wordFrequencies = new WordFrequencies(words); var expected = StringList("a"); var numToFind = 1; // Act var actual = wordFrequencies.GetNthMostOccurring(numToFind); // Assert AssertListsAreEqual(expected, actual); }
public void InBetweenFrequenciesReturnsNothingTest() { // Arrange var words = StringList("a", "a", "b", "b", "c"); var wordFrequencies = new WordFrequencies(words); List <string> expected = null; var numToFind = 2; // Act var actual = wordFrequencies.GetNthMostOccurring(numToFind); // Assert AssertListsAreEqual(expected, actual); }