public Validate ( |
||
response | the active response object | |
return | void |
public void TestAPIActionValidateDateDrift() { string TestURIProtocol = "asdf"; WebRequest.RegisterPrefix(TestURIProtocol, new WebRequestTestCreate()); var request = (HttpWebRequestTest)WebRequest.Create("asdf://www.example.com/"); var signer = new EdgeGridV1Signer(); var response = request.CreateResponse(HttpStatusCode.ServiceUnavailable, "Server Unavailable"); var currentDate = DateTime.UtcNow.AddMinutes(-2); var headers = new WebHeaderCollection { { "Date", currentDate.ToString("r") } }; response = request.CreateResponse(HttpStatusCode.ServiceUnavailable, "Server Unavailable", headers); try { signer.Validate(response); } catch (Exception ex) { Assert.AreEqual(ex.Message, "Local server Date is more than 30s out of sync with Remote server"); throw ex; } }
public void TestAPIActionValidateOK() { string TestURIProtocol = "asdf"; WebRequest.RegisterPrefix(TestURIProtocol, new WebRequestTestCreate()); var request = (HttpWebRequestTest)WebRequest.Create("asdf://www.example.com/"); var signer = new EdgeGridV1Signer(); var response = request.CreateResponse(); signer.Validate(response); }
public void TestAPIActionValidateUnavailable() { string TestURIProtocol = "asdf"; WebRequest.RegisterPrefix(TestURIProtocol, new WebRequestTestCreate()); var request = (HttpWebRequestTest)WebRequest.Create("asdf://www.example.com/"); var signer = new EdgeGridV1Signer(); var response = request.CreateResponse(HttpStatusCode.ServiceUnavailable, "Server Unavailable"); var currentDate = DateTime.UtcNow; var headers = new WebHeaderCollection { { "Date", currentDate.ToString("r") } }; response = request.CreateResponse(HttpStatusCode.ServiceUnavailable, "Server Unavailable", headers); signer.Validate(response); }