public void TestApiNoKeyGiven() { var response = GopApiHelper.Execute( "http://content.guardianapis.com/", "search", null, null, null); Assert.AreEqual(response.message.Value, "No API key found in headers or querystring"); }
public void TestInvalidApiKeyWithoutFilter() { var response = GopApiHelper.Execute( "http://content.guardianapis.com/", "search", "InvalidKey", null, null); Assert.AreEqual(response.message.Value, "Invalid authentication credentials"); }
public void TestApiAvailability() { var response = GopApiHelper.Execute( "http://content.guardianapis.com/", "search", "30c5a1f2-3132-4f94-bba1-38b397fdec67", null, null); Assert.AreEqual(response.response.status.Value, "ok"); }
public void TestSearchBySection() { var response = GopApiHelper.Execute( "http://content.guardianapis.com/", "search", "30c5a1f2-3132-4f94-bba1-38b397fdec67", null, new SectionFilter("world")); Assert.AreEqual(response.response.status.Value, "ok"); }
public void TestSearchByDate() { var response = GopApiHelper.Execute( "http://content.guardianapis.com/", "search", "30c5a1f2-3132-4f94-bba1-38b397fdec67", null, new DateFilter(new DateTime(2017, 9, 17))); Assert.AreEqual(response.response.status.Value, "ok"); }
public void TestSearchByInvalidDate() { var response = GopApiHelper.Execute( "http://content.guardianapis.com/", "search", "30c5a1f2-3132-4f94-bba1-38b397fdec67", null, new Filter("to-date") { Value = "null" }); Assert.AreEqual(response.response.status.Value, "error"); }