public void SendThreeDSecureInvalidResponseHashTest() { //get sample response XML ThreeDSecureResponse fromXmlResponse = new ThreeDSecureResponse().FromXml(Resources._3ds_verify_enrolled_response_sample); fromXmlResponse.Hash = "invalid hash"; //mock HttpResponse _handler.AddFakeResponse(HttpConfiguration.DEFAULT_ENDPOINT, new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(fromXmlResponse.ToXml()) }); //create empty request ThreeDSecureRequest request = new ThreeDSecureRequest(); //create configuration HttpConfiguration httpConfiguration = new HttpConfiguration(); httpConfiguration.OnlyAllowHttps = false; //mock HttpClient instance HttpClient httpClientMock = new HttpClient(_handler); //execute send on client RealexClient realexClient = new RealexClient(SampleXmlValidationUtils.SECRET, httpConfiguration, httpClientMock); realexClient.Send(request); //shouldn't get this far Assert.Fail("RealexException should have been thrown before this point."); }
public void SendThreeDSecureVerifyEnrolledTest() { //get sample response XML ThreeDSecureResponse fromXmlResponse = new ThreeDSecureResponse().FromXml(Resources._3ds_verify_enrolled_response_sample); //mock HttpResponse _handler.AddFakeResponse(HttpConfiguration.DEFAULT_ENDPOINT, new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(fromXmlResponse.ToXml()) }); //create empty request ThreeDSecureRequest request = new ThreeDSecureRequest(); //create configuration HttpConfiguration httpConfiguration = new HttpConfiguration(); httpConfiguration.OnlyAllowHttps = false; //mock HttpClient instance HttpClient httpClientMock = new HttpClient(_handler); //execute send on client RealexClient realexClient = new RealexClient(SampleXmlValidationUtils.SECRET, httpConfiguration, httpClientMock); ThreeDSecureResponse response = realexClient.Send(request); //validate response SampleXmlValidationUtils.checkUnmarshalledThreeDSecureEnrolledResponse(response); }