public void Given_SearchQuery_Expect_NoUrlParameters() { var query = new MockSearchQuery("/MockQuery/search"); var url = query.GetRequestUrl(); Assert.IsFalse(url.Contains("?"), "Url should not contain '?'"); Assert.IsFalse(url.Contains("&"), "Url should not contain '&'"); Assert.IsFalse(url.Contains("="), "Url should not contain '='"); }
public void Given_SearchQuery_Expect_WellFormedUrl() { var inputDateTime = new DateTime(2017, 01, 01); var inputAuthorName = "ExampleName"; var query = new MockSearchQuery("/MockQuery/search"); query.AfterDateTime = new AfterParameter(inputDateTime); query.Author = new AuthorParameter(inputAuthorName); var url = query.GetRequestUrl(); Assert.IsFalse(url.Contains(" "), $"Url should not contain any spaces"); Assert.IsTrue(url.Contains("&"), "Url should contain '&'"); Assert.IsTrue(url.Contains("="), "Url should contain '='"); Assert.IsTrue(url.Contains("?"), "Url should contain '?'"); Assert.IsTrue(url.Contains(inputAuthorName), $"Url should contain '{inputAuthorName}'"); Assert.IsTrue(url.Contains(inputDateTime.ToUnixEpoch().ToString()), $"Url should contain '{inputDateTime.ToUnixEpoch().ToString()}'"); }