public void GetLongestString_GivenNegative_ThrowsInvalidArgumentException() { var ls = new LongestString(); var invalidNthValue = -1; Assert.Throws <ArgumentException>(() => ls.GetNthLongestString(invalidNthValue, TestInputList)); }
public void GetLongestString_ItemsWithNLengthInMultiplePositions_ReturnsItemClosestToHeadOfList(int positionOfStringThatHasPartnersOfSameLength, string expectedResult) { var ls = new LongestString(); var actualResult = ls.GetNthLongestString(positionOfStringThatHasPartnersOfSameLength, TestInputList); Assert.AreEqual(expectedResult, actualResult); }
public void GetShortestString_ListIsNull_ThrowsNullReferenceException() { var ls = new LongestString(); List <string> aNullList = null; var aValidNthValue = 1; Assert.Throws <NullReferenceException>(() => ls.GetNthLongestString(aValidNthValue, aNullList)); }
public void GetLongestString_ListIsEmpty_ThrowsInvalidArgumentException() { var ls = new LongestString(); var anEmptyList = new List <string>(); var aValidNthValue = 1; Assert.Throws <ArgumentException>(() => ls.GetNthLongestString(aValidNthValue, anEmptyList)); }
public void GetLongestString_GivenNumberGreaterThanListLength_ReturnsShortestWord() { var ls = new LongestString(); var positionGreaterThanListLength = 20; var expectedResult = "Cat"; var actualResult = ls.GetNthLongestString(positionGreaterThanListLength, TestInputList); Assert.AreEqual(expectedResult, actualResult); }
public void GetLongestString_Normally_ReturnsTheLongestString() { var ls = new LongestString(); var positionOfLongestString = 1; var expectedResult = "This code puzzle is easy"; var actualResult = ls.GetNthLongestString(positionOfLongestString, TestInputList); Assert.AreEqual(expectedResult, actualResult); }
public void GetLongestString_Normally_ReturnsTheSpecifiedPosition() { var ls = new LongestString(); var positionOfLongestString = 2; var expectedResult = "AVeryLongString"; var actualResult = ls.GetNthLongestString(positionOfLongestString, TestInputList); Assert.AreEqual(expectedResult, actualResult); }
public void GetLongestString_GivenNegative_ThrowsInvalidArgumentException() { var ls = new LongestString(); var invalidNthValue = -1; Assert.Throws<ArgumentException>(() => ls.GetNthLongestString(invalidNthValue, TestInputList)); }
public void GetShortestString_ListIsNull_ThrowsNullReferenceException() { var ls = new LongestString(); List<string> aNullList = null; var aValidNthValue = 1; Assert.Throws<NullReferenceException>(() => ls.GetNthLongestString(aValidNthValue, aNullList)); }
public void GetLongestString_ListIsEmpty_ThrowsInvalidArgumentException() { var ls = new LongestString(); var anEmptyList = new List<string>(); var aValidNthValue = 1; Assert.Throws<ArgumentException>(() => ls.GetNthLongestString(aValidNthValue, anEmptyList)); }