Esempio n. 1
0
 protected void AssertStatusGoodSuccessMarkerNoConnectionIssuesForPeriodicPayment(SecurePayMessage r)
 {
     Assert.IsNotNull(r);
     Assert.That(r.Status.StatusDescription, Is.Not.ContainsSubstring("Unable to connect to server"));
     Assert.That(r.Status.StatusDescription, Is.EqualTo("Normal"));
     Assert.True(SecurePayGateway.ValidSuccessResponseCode.Contains(r.Status.StatusCode));
     Assert.True(r.WasSuccessful());
     Assert.That(r.Periodic.PeriodicList.PeriodicItem[0].Successful, Is.EqualTo("yes"));
 }
 private static void Defend(bool condition, string method, SecurePayMessage response)
 {
     Defend(condition, method, response.Status.StatusCode, response.Status.StatusDescription);
 }
        private void ValidateReponse(SecurePayMessage response, string callingMethod)
        {
            Defend(!IsAnApprovedSuccessResponseCode(response.Status.StatusCode), callingMethod, response);

            var p = response.Periodic;

            if (p == null || p.PeriodicList == null || p.PeriodicList.PeriodicItem == null)
            {
                return;
            }

            foreach (var pi in p.PeriodicList.PeriodicItem)
            {
                Defend(!IsAnApprovedSuccessResponseCode(pi.ResponseCode), callingMethod, pi.ResponseCode, pi.ResponseText);
            }
        }
        public void SecurePayMessage_WasSuccessful()
        {
            foreach (var code in new List<int> { 0, 8, 11, 16, 77 })
            {
                var spm = new SecurePayMessage
                    {
                        Status = new SecurePayStatus { StatusDescription = "Normal", StatusCode = code }
                    };

                Assert.True(spm.WasSuccessful(), string.Format("Code '{0}' did not return success", code));
            }
        }