コード例 #1
0
        public void TestToString()
        {
            CreditCard cc1 = new CreditCard("AA", "hi", "Me", new DateTime(2012, 12, 1), 1165131, 15);
            CreditCard cc2 = new CreditCard("BB", "oi", "you", new DateTime(2013, 09, 1), 156135, 17);

            Assert.AreEqual("Credit Card\nCard Name: AA\nCard Number: 1165131\nOwner: Me\nBank: hi\nValidity: 2012/12\nLimit: 15", cc1.ToString());
            Assert.AreEqual("Credit Card\nCard Name: BB\nCard Number: 156135\nOwner: you\nBank: oi\nValidity: 2013/9\nLimit: 17", cc2.ToString());
        }
コード例 #2
0
        public void TestToString()
        {
            Money money1 = new Money("EUR");
            Payment pay1 = new Payment(money1, 15);
            Assert.AreEqual("Payment: Money\nCurrency: EUR\nAmount: 15", pay1.ToString());

            DebitCard dc1 = new DebitCard("AAA", "123A", "Me", new DateTime(2013, 07, 1), 157568);
            Payment pay2 = new Payment(dc1, 53.5);
            Assert.AreEqual("Payment: Debit Card\nCard Name: AAA\nCard Number: 157568\nOwner: Me\nBank: 123A\nValidity: 2013/7\nAmount: 53,5", pay2.ToString());

            CreditCard cc1 = new CreditCard("AA", "hi", "Me", new DateTime(2012, 12, 1), 1165131, 15);
            Payment pay3 = new Payment(cc1, 125);
            Assert.AreEqual("Payment: Credit Card\nCard Name: AA\nCard Number: 1165131\nOwner: Me\nBank: hi\nValidity: 2012/12\nLimit: 15\nAmount: 125", pay3.ToString());
        }
コード例 #3
0
        /// <summary>
        /// The controller method to create the credit card
        /// </summary>
        /// <param name="cardName">the card name</param>
        /// <param name="bank">the card bank</param>
        /// <param name="owner">the card owner</param>
        /// <param name="valid">the card validity</param>
        /// <param name="number">the card number</param>
        /// <param name="limit">the card limit</param>
        public void CreateCreditCard(string cardName, string bank, string owner, DateTime valid, int number, int limit)
        {
            CreditCard cc = new CreditCard(cardName, bank, owner, valid, number, limit);

            PersistenceFactory.GetFactory().GetRepository().GetPaymentMethodRepository().Save(cc);
        }