public void TestCustomAttribute5() { fraudCheck fraudCheck = new fraudCheck(); advancedFraudChecksType advancedFraudCheck = new advancedFraudChecksType(); fraudCheck.advancedFraudChecks = advancedFraudCheck; advancedFraudCheck.threatMetrixSessionId = "123"; advancedFraudCheck.customAttribute1 = "abc"; advancedFraudCheck.customAttribute2 = "def"; advancedFraudCheck.customAttribute3 = "ghi"; advancedFraudCheck.customAttribute4 = "jkl"; advancedFraudCheck.customAttribute5 = "mno"; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex("..*<threatMetrixSessionId>123</threatMetrixSessionId>\r\n<customAttribute1>abc</customAttribute1>\r\n<customAttribute2>def</customAttribute2>\r\n<customAttribute3>ghi</customAttribute3>\r\n<customAttribute4>jkl</customAttribute4>\r\n<customAttribute5>mno</customAttribute5>\r\n.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >())) .Returns("<cnpOnlineResponse version='10.1' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><fraudCheckResponse id='127' reportGroup='Planets' customerId=''><cnpTxnId>742802348034313000</cnpTxnId><response>000</response><message>Approved</message><advancedFraudResults><deviceReviewStatus>pass</deviceReviewStatus><deviceReputationScore>42</deviceReputationScore><triggeredRule>triggered_rule_default</triggeredRule></advancedFraudResults></fraudCheckResponse></cnpOnlineResponse >"); Communications mockedCommunication = mock.Object; cnp.SetCommunication(mockedCommunication); fraudCheckResponse fraudCheckResponse = cnp.FraudCheck(fraudCheck); Assert.NotNull(fraudCheckResponse); Assert.AreEqual(742802348034313000, fraudCheckResponse.cnpTxnId); }
public fraudCheckResponse FraudCheck(fraudCheck fraudCheck) { litleOnlineRequest request = createLitleOnlineRequest(); fillInReportGroup(fraudCheck); request.fraudCheck = fraudCheck; litleOnlineResponse response = sendToLitle(request); fraudCheckResponse fraudCheckResponse = (fraudCheckResponse)response.fraudCheckResponse; return(fraudCheckResponse); }
public void TestNoCustomAttributes() { fraudCheck fraudCheck = new fraudCheck(); advancedFraudChecksType advancedFraudCheck = new advancedFraudChecksType(); fraudCheck.advancedFraudChecks = advancedFraudCheck; advancedFraudCheck.threatMetrixSessionId = "123"; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<threatMetrixSessionId>123</threatMetrixSessionId>\r\n.*", RegexOptions.Singleline))) .Returns("<cnpOnlineResponse version='10.1' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><fraudCheckResponse id='127' reportGroup='Planets' customerId=''><cnpTxnId>742802348034313000</cnpTxnId><response>000</response><message>Approved</message><advancedFraudResults><deviceReviewStatus>pass</deviceReviewStatus><deviceReputationScore>42</deviceReputationScore><triggeredRule>triggered_rule_default</triggeredRule></advancedFraudResults></fraudCheckResponse></cnpOnlineResponse >"); Communications mockedCommunication = mock.Object; cnp.SetCommunication(mockedCommunication); fraudCheckResponse fraudCheckResponse = cnp.FraudCheck(fraudCheck); Assert.NotNull(fraudCheckResponse); Assert.AreEqual("pass", fraudCheckResponse.advancedFraudResults.deviceReviewStatus); }