Esempio n. 1
0
 public void AddCreditCardsToCustomer()
 {
     var mockLogger = new Mock<ILogger>();
     var settings = GetPopulatedSettingsObj();
     var repo = new QBRepository(mockLogger.Object, settings);
     var cust = GetPopulatedCustomer();
     cust.CreditCards[0].CardholderName = RandomString(10);
     cust.CreditCards[0].CardNumber = GetRandomNumber(100, 200).ToString();
     repo.AddCreditCardsForCustomer(cust.CreditCards, "80002E4E-1279074492");
     var custAfter = repo.GetCustomerByID("80002E4E-1279074492");
     Assert.IsTrue(cust.CreditCards[0].CardholderName == custAfter.CreditCards[0].CardholderName);
 }
Esempio n. 2
0
 public void AddCreditCardsWithNewCustomer()
 {
     var custOrig = this.GetPopulatedCustomer();
     var mockLogger = new Mock<ILogger>();
     var settings = GetPopulatedSettingsObj();
     var repo = new QBRepository(mockLogger.Object, settings);
                 var id = repo.AddCustomer(custOrig);
     var cust = repo.GetCustomerByID(id);
     Assert.IsTrue(cust.CreditCards[0].CardholderName == custOrig.CreditCards[0].CardholderName);
 }
Esempio n. 3
0
        public void ModifyCreditCardInfo()
        {
            string cholderName = RandomString(10);
            string cardnum = GetRandomNumber(1000, 999999).ToString();
            string expiration = GetRandomDay().ToShortDateString();
            string note = RandomString(10);

            var mockLogger = new Mock<ILogger>();
            var settings = GetPopulatedSettingsObj();
            var repo = new QBRepository(mockLogger.Object, settings);
            var existingCustomer = repo.GetCustomerByID("80002E4C-1279071429");
            var newCardType = ChangeCreditCardType(existingCustomer.CreditCards[1].CreditCardType);
            existingCustomer.CreditCards[1].CreditCardType = newCardType;
            existingCustomer.CreditCards[1].CardholderName = cholderName;
            existingCustomer.CreditCards[1].CardNumber = cardnum;
            existingCustomer.CreditCards[1].ExpirationDate = expiration;
            existingCustomer.CreditCards[1].Note = note;

            repo.ModifyCreditCardsForCustomer(existingCustomer.CreditCards, existingCustomer.CustomerID);

            var modifiedCust = repo.GetCustomerByID("80002E4C-1279071429");

            Assert.IsTrue(cholderName == modifiedCust.CreditCards[1].CardholderName);
            Assert.IsTrue(cardnum == modifiedCust.CreditCards[1].CardNumber);
            Assert.IsTrue(expiration == modifiedCust.CreditCards[1].ExpirationDate);
            Assert.IsTrue(newCardType == modifiedCust.CreditCards[1].CreditCardType);
        }
Esempio n. 4
0
 public void AddCustomer()
 {
     var mockLogger = new Mock<ILogger>();
     var settings = GetPopulatedSettingsObj();
     var repo = new QBRepository(mockLogger.Object, settings);
     var id = repo.AddCustomer(this.GetPopulatedCustomer());
     var cust = repo.GetCustomerByID(id);
     Assert.IsTrue(cust != null);
 }