public void ValidateKeyValueListWithOrderByTermIsTrue_GivenValidDesiredOrderByElements() { string commaSeparatedOrderBy = "testTerm1,testTerm2_desc,testTerm3_asc"; List <string> desiredOrderByTerms = new List <string> { "testTerm1", "testTerm2", "testTerm3" }; var orderByHelper = new OrderByHelper(); var convertedList = orderByHelper.ConvertCommaSeparateOrderByStringToKeyValuePairList(commaSeparatedOrderBy); try { orderByHelper.ValidateOrderByListOnlyContainsCertainElements(convertedList, desiredOrderByTerms); } catch (InvalidFormatException invalidFormatException) { Assert.True(false, $"Expected no Exception but an invalid formate exception was thrown with message '{invalidFormatException.Message}'"); } Assert.True(true); }
public void ValidateKeyValueListWithOrderByTermThrowsException_GivenInValidDesiredOrderByElements() { string commaSeparatedOrderBy = "testTerm1,testTerm2_desc,testTerm5_asc"; List <string> desiredOrderByTerms = new List <string> { "testTerm1", "testTerm2", "testTerm3" }; var orderByHelper = new OrderByHelper(); var convertedList = orderByHelper.ConvertCommaSeparateOrderByStringToKeyValuePairList(commaSeparatedOrderBy); Assert.Throws <InvalidFormatException>(() => orderByHelper.ValidateOrderByListOnlyContainsCertainElements(convertedList, desiredOrderByTerms)); }