Example #1
0
        //[TestMethod()]
        //public void DeclineCC()
        //{
        //    CreditCardLogic target = new CreditCardLogic();

        //    #region set cc data
        //    CreditCard creditCardData = new CreditCard();
        //    creditCardData.CCAddress = ccaddress;
        //    creditCardData.CCCity = cccity;
        //    creditCardData.CCExpMonth = short.Parse(ccexpmonth);
        //    creditCardData.CCExpYear = short.Parse(ccexpyear);
        //    creditCardData.CCName = ccname;
        //    creditCardData.CCPostalCode = ccpostalcode;
        //    creditCardData.CCState = ccstate;
        //    #endregion

        //    #region set member data
        //    Member memberData = new Member();
        //    memberData.Salutation = updatedsalutation;
        //    memberData.FirstName = updatedfirstname;
        //    memberData.MiddleInitial = updatedmiddleinitial;
        //    memberData.LastName = updatedlastname;
        //    memberData.Suffix = updatedsuffix;
        //    memberData.ProfessionalTitle = updatedprofessionaltitle;
        //    memberData.Email = updatedemail;
        //    memberData.OptIn = updatedoptin;
        //    memberData.Address.BusinessName = updatedbusinessname;
        //    memberData.Address.Address1 = updatedaddress1;
        //    memberData.Address.Address2 = updatedaddress2;
        //    memberData.Address.Address3 = updatedaddress3;
        //    memberData.Address.City = updatedcity;
        //    memberData.Address.State = updatedstate;
        //    memberData.Address.PostalCode = updatedpostalcode;
        //    memberData.Address.Country = updatedcountry;
        //    memberData.Address.Phone = updatedphone;
        //    memberData.Address.Fax = updatedfax;
        //    memberData.Address.AltCity = updatedaltcity;
        //    #endregion

        //    creditCardData.CCNumber = badamex;

        //    throw new NotImplementedException();
        //    //BaseResponse actual = target.ChargeCard(creditCardData, memberData, amountpaid, debug);
        //    //Assert.AreEqual(true, actual != null && actual.TypedResponse != null
        //    //    && !actual.TypedResponse.Success
        //    //    && actual.Messages != null
        //    //    && actual.Messages.Count >= 1
        //    //    && actual.Messages[0].SfgCode == "135");


        //    //creditCardData.CCNumber = baddisc;
        //    //actual = target.ChargeCard(creditCardData, memberData, amountpaid, debug);
        //    //Assert.AreEqual(true, actual != null && actual.TypedResponse != null
        //    //    && !actual.TypedResponse.Success
        //    //    && actual.Messages != null
        //    //    && actual.Messages.Count >= 1
        //    //    && actual.Messages[0].SfgCode == "135");


        //    //creditCardData.CCNumber = badmc;
        //    //actual = target.ChargeCard(creditCardData, memberData, amountpaid, debug);
        //    //Assert.AreEqual(true, actual != null && actual.TypedResponse != null
        //    //    && !actual.TypedResponse.Success
        //    //    && actual.Messages != null
        //    //    && actual.Messages.Count >= 1
        //    //    && actual.Messages[0].SfgCode == "135");


        //    //creditCardData.CCNumber = badvisa;
        //    //actual = target.ChargeCard(creditCardData, memberData, amountpaid, debug);
        //    //Assert.AreEqual(true, actual != null && actual.TypedResponse != null
        //    //    && !actual.TypedResponse.Success
        //    //    && actual.Messages != null
        //    //    && actual.Messages.Count >= 1
        //    //    && actual.Messages[0].SfgCode == "135");
        //}
        #endregion

        #region New order end to end test
        //[TestMethod]
        //public void TestNewOrderComplete()
        //{
        //    memberid = null;
        //    string[] ret = ApproveCC(goodamex);
        //    string verifoneid = ret[0];
        //    string authid = ret[1];
        //    if (verifoneid != null && authid != null)
        //    {
        //        string fname = verifoneid.ToString();
        //        string lname = verifoneid.ToString();
        //        string add1 = verifoneid.ToString();
        //        string mbrid = CreateSubscription(fname, lname, add1, verifoneid);
        //        if (mbrid != null)
        //        {
        //            BaseResponse mbrresponse = GetMemberByMemberId(mbrid);
        //            if (mbrresponse != null && mbrresponse.TypedResponse != null && mbrresponse.TypedResponse.Success)
        //            {
        //                GetMemberResponse mbr = (GetMemberResponse)mbrresponse.TypedResponse;

        //                if (CreateLogin(updatedaddress1, updatedaddress2, updatedaddress3, updatedcity, updatedstate, updatedcountry, updatedpostalcode,
        //                        "TEST", updatedpwd, "PERSONAL", updatedsalutation, updatedfirstname, updatedmiddleinitial, updatedlastname, updatedsuffix,
        //                        updatedemail, updatedusername, mbr.MemberData.MemberId, pubcode, DateTime.Now.AddYears(1), DateTime.Now)
        //                    > 0)
        //                {
        //                    CustomerService.CustomerService client = new Tests.CustomerService.CustomerService();

        //                    string enc_username = HarperCRYPTO.Cryptography.Encrypt256(updatedusername);
        //                    string enc_password = HarperCRYPTO.Cryptography.Encrypt256(updatedpwd);

        //                    int expected = 0;
        //                    Tests.CustomerService.ResponseObject actual = client.Login(enc_username, enc_password, true, false);
        //                    Assert.AreEqual(expected, actual.ResponseCode);
        //                }
        //            }
        //        }
        //    }
        //}

        #region methods used by TestNewOrderComplete
        public bool doPing()
        {
            HeartbeatLogic target = new HeartbeatLogic();
            BaseResponse   actual = target.Ping();

            return(actual != null && actual.TypedResponse != null && actual.TypedResponse.Success);
        }
        public BaseResponse Ping()
        {
            BaseResponse baseResponse = new BaseResponse();

            try
            {
                baseResponse = new HeartbeatLogic().Ping();
            }
            catch (Exception ex)
            {
                EventLogger.LogError("MembershipService.Ping",
                                     string.Format("Message: {0} \r\nStackTrace: {1}", ex.Message, ex.StackTrace));
            }
            return(baseResponse);
        }