public void InitTests()
        {
            _testcustomer = new Customer();

            _testcustomer.CustID             = 1;
            _testcustomer.AcctStatus         = "Testing";
            _testcustomer.Balance            = 107;
            _testcustomer.BillingRefRequired = false;
            _testcustomer.BillToAddress1     = "123 Any St.";
            _testcustomer.BillToAddress2     = "Suite 100";
            _testcustomer.BillToAttnName     = "Clark Kent";
            _testcustomer.BillToCity         = "Austin";
            _testcustomer.BillToID           = 1001;
            _testcustomer.BillToState        = "TX";
            _testcustomer.BillToZip          = "78727";
            _testcustomer.CardExpMonth       = 9;
            _testcustomer.CardExpYear        = 2015;
            _testcustomer.CardNo             = "4111111111111111";
            _testcustomer.CardType           = "VISA";
            _testcustomer.Comments           = "delicious";
            _testcustomer.CreditAvail        = 10;
            _testcustomer.CustContactName    = "Clark Kent";
            _testcustomer.CustContactPhone   = "5555555555";
            _testcustomer.CustName           = "Clarky";
            _testcustomer.DateOpened         = new DateTime(1971, 10, 10);
            _testcustomer.DOWBillingCode     = "idunno";
            _testcustomer.EDICustomer        = false;
            _testcustomer.PayMethodID        = 'A';
            _testcustomer.PhyAddress1        = "123 Other St.";
            _testcustomer.PhyAddress2        = "Suite 10000-A";

            _testlsocustomer = new LsoCustomer();

            _testlsocustomer.CustID             = 1;
            _testlsocustomer.AcctStatus         = "Testing";
            _testlsocustomer.Balance            = 107;
            _testlsocustomer.BillingRefRequired = false;
            _testlsocustomer.BillToAddress1     = "123 Any St.";
            _testlsocustomer.BillToAddress2     = "Suite 100";
            _testlsocustomer.BillToAttnName     = "Clark Kent";
            _testlsocustomer.BillToCity         = "Austin";
            _testlsocustomer.BillToID           = 1001;
            _testlsocustomer.BillToState        = "TX";
            _testlsocustomer.BillToZip          = "78727";
            _testlsocustomer.CardExpMonth       = 9;
            _testlsocustomer.CardExpYear        = 2015;
            _testlsocustomer.CardNo             = "4111111111111111";
            _testlsocustomer.CardType           = "VISA";
            _testlsocustomer.Comments           = "delicious";
            _testlsocustomer.CreditAvail        = 10;
            _testlsocustomer.CustContactName    = "Clark Kent";
            _testlsocustomer.CustContactPhone   = "5555555555";
            _testlsocustomer.CustName           = "Clarky";
            _testlsocustomer.DateOpened         = new DateTime(1971, 10, 10);
            _testlsocustomer.DOWBillingCode     = "idunno";
            _testlsocustomer.EDICustomer        = false;
            _testlsocustomer.PayMethodID        = 'A';
            _testlsocustomer.PhyAddress1        = "123 Other St.";
            _testlsocustomer.PhyAddress2        = "Suite 10000-A";
        }
        public void Class_Change_Tracking_Interface_Works()
        {
            var customer = new LsoCustomer();

            customer.AcceptChanges();
            Assert.IsFalse(customer.IsChanged);
            customer.CustContactPhone = "5555555555";
            Assert.IsTrue(customer.IsChanged);
        }
        public void Setting_Class_Properties_Raises_Event()
        {
            var  customer    = new LsoCustomer();
            bool eventRaised = false;

            customer.PropertyChanged +=
                delegate(object sender, System.ComponentModel.PropertyChangedEventArgs e)
            {
                eventRaised = true;
                Assert.AreEqual("CustContactName", e.PropertyName);
            };

            customer.CustContactName = "Cooter";
            Assert.IsTrue(eventRaised);
        }
        public void Class_Properties_Change_Tracking_List_Works()
        {
            var customer = new LsoCustomer();

            customer.AcceptChanges();

            Assert.AreEqual(0, customer.ChangedPropertiesCount);

            customer.CustContactPhone   = "5555555555";
            customer.CustID             = 501;
            customer.DateOpened         = DateTime.Now;
            customer.Balance            = 0;
            customer.BillingRefRequired = false;
            customer.CardExpMonth       = 0;
            customer.CreditAvail        = 0;
            customer.PriceSchedule      = 0;

            Assert.AreEqual(8, customer.ChangedPropertiesCount);
        }
Exemple #5
0
        public void Can_Add_Customer_Objects_To_Repository()
        {
            var newaccount = new LsoCustomer();

            newaccount.AcctStatus                  = "TST";
            newaccount.Balance                     = 107;
            newaccount.BillingRefRequired          = false;
            newaccount.BillToAddress1              = "123 Any St.";
            newaccount.BillToAddress2              = "Suite 100";
            newaccount.BillToAttnName              = "Clark Kent";
            newaccount.BillToCity                  = "Austin";
            newaccount.BillToID                    = 1001;
            newaccount.BillToState                 = "TX";
            newaccount.BillToZip                   = "78727";
            newaccount.CardExpMonth                = 9;
            newaccount.CardExpYear                 = 2015;
            newaccount.CardNo                      = "4111111111111111";
            newaccount.CardType                    = "VISA";
            newaccount.Comments                    = "delicious";
            newaccount.CreditAvail                 = 10;
            newaccount.CustContactName             = "Clark Kent";
            newaccount.CustContactPhone            = "5555555555";
            newaccount.CustName                    = "Clarky";
            newaccount.DateOpened                  = new DateTime(1971, 10, 10);
            newaccount.DOWBillingCode              = "ABCD";
            newaccount.EDICustomer                 = false;
            newaccount.PayMethodID                 = 'A';
            newaccount.PhyAddress1                 = "123 Other St.";
            newaccount.PhyAddress2                 = "Suite 10000-A";
            newaccount.newCustomerReferralSourceID = new Guid();
            newaccount.TieredDiscountWindow        = 4;
            newaccount.WaiveSecuredFacilityFee     = true;
            newaccount.WaivePickupEventFee         = true;


            newaccount.CCOptOut = true;

            _repository.Add(newaccount);

            // Test Data on server should return 25001 for first new customer after restore state
            var accountsearch = _repository.GetAllWithCustId(25001);

            Assert.AreEqual(1, accountsearch.Count);

            var dbsearch = accountsearch[0];

            Assert.AreEqual(25001, dbsearch.CustID);
            Assert.AreEqual(newaccount.CustID, dbsearch.CustID);
            Assert.AreEqual(newaccount.AcctStatus, dbsearch.AcctStatus);
            Assert.AreEqual(newaccount.Balance, dbsearch.Balance);
            Assert.AreEqual(newaccount.BillingRefRequired, dbsearch.BillingRefRequired);
            Assert.AreEqual(newaccount.BillToAddress1, dbsearch.BillToAddress1);
            Assert.AreEqual(newaccount.BillToAddress2, dbsearch.BillToAddress2);
            Assert.AreEqual(newaccount.BillToAttnName, dbsearch.BillToAttnName);
            Assert.AreEqual(newaccount.BillToCity, dbsearch.BillToCity);
            Assert.AreEqual(newaccount.BillToID, dbsearch.BillToID);
            Assert.AreEqual(newaccount.BillToState, dbsearch.BillToState);
            Assert.AreEqual(newaccount.BillToZip, dbsearch.BillToZip);
            Assert.AreEqual(newaccount.CardExpMonth, dbsearch.CardExpMonth);
            Assert.AreEqual(newaccount.CardExpYear, dbsearch.CardExpYear);
            Assert.AreEqual(newaccount.CardNo, dbsearch.CardNo);
            Assert.AreEqual(newaccount.CardType, dbsearch.CardType);
            Assert.AreEqual(newaccount.Comments, dbsearch.Comments);
            Assert.AreEqual(newaccount.CreditAvail, dbsearch.CreditAvail);
            Assert.AreEqual(newaccount.CustContactName, dbsearch.CustContactName);
            Assert.AreEqual(newaccount.CustContactPhone, dbsearch.CustContactPhone);
            Assert.AreEqual(newaccount.CustName, dbsearch.CustName);
            Assert.AreEqual(newaccount.DateOpened, dbsearch.DateOpened);
            Assert.AreEqual(newaccount.DOWBillingCode, dbsearch.DOWBillingCode);
            Assert.AreEqual(newaccount.EDICustomer, dbsearch.EDICustomer);
            Assert.AreEqual(newaccount.PayMethodID, dbsearch.PayMethodID);
            Assert.AreEqual(newaccount.PhyAddress1, dbsearch.PhyAddress1);
            Assert.AreEqual(newaccount.PhyAddress2, dbsearch.PhyAddress2);
            Assert.AreEqual(newaccount.newCustomerReferralSourceID, dbsearch.newCustomerReferralSourceID);
            Assert.AreEqual(newaccount.TieredDiscountWindow, dbsearch.TieredDiscountWindow);
            Assert.AreEqual(newaccount.WaiveSecuredFacilityFee, dbsearch.WaiveSecuredFacilityFee);
            Assert.AreEqual(newaccount.WaivePickupEventFee, dbsearch.WaivePickupEventFee);
            Assert.AreEqual(newaccount.CCOptOut, dbsearch.CCOptOut);
        }