public void Query_is_parsed_and_trimmed() { var parser = new MatchFilterQueryStringParser(); var filter = parser.ParseQueryString(new MatchFilter(), HttpUtility.ParseQueryString("q=%20hello%20world%20")); Assert.Equal("hello world", filter.Query); }
public void UntilDate_is_parsed() { var parser = new MatchFilterQueryStringParser(); var filter = parser.ParseQueryString(new MatchFilter(), HttpUtility.ParseQueryString("to=2022-06-09")); Assert.Equal(new DateTime(2022, 6, 9), filter.UntilDate.Value.Date); }
public void Missing_empty_or_invalid_UntilDate_is_null(string queryString) { var parser = new MatchFilterQueryStringParser(); var filter = parser.ParseQueryString(new MatchFilter(), HttpUtility.ParseQueryString(queryString)); Assert.Null(filter.UntilDate); }
public void FromDate_is_parsed() { var parser = new MatchFilterQueryStringParser(); var filter = parser.ParseQueryString(new MatchFilter(), HttpUtility.ParseQueryString("?from=2020-07-10")); Assert.Equal(new DateTime(2020, 7, 10), filter.FromDate.Value.Date); }
public void Null_querystring_throws_ArgumentNullException() { var parser = new MatchFilterQueryStringParser(); Assert.Throws <ArgumentNullException>(() => _ = parser.ParseQueryString(new MatchFilter(), null)); }
public void Null_filter_throws_ArgumentNullException() { var parser = new MatchFilterQueryStringParser(); Assert.Throws <ArgumentNullException>(() => _ = parser.ParseQueryString(null, new NameValueCollection())); }