コード例 #1
0
        public void TestToString()
        {
            DebitCard dc1 = new DebitCard("AAA", "123A", "Me", new DateTime(2013, 07, 1), 157568);
            DebitCard dc2 = new DebitCard("BASD", "qwwe", "You", new DateTime(4000, 12, 7), 16416);

            Assert.AreEqual("Debit Card\nCard Name: AAA\nCard Number: 157568\nOwner: Me\nBank: 123A\nValidity: 2013/7", dc1.ToString());
            Assert.AreEqual("Debit Card\nCard Name: BASD\nCard Number: 16416\nOwner: You\nBank: qwwe\nValidity: 4000/12", dc2.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 debit 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>
        public void CreateDebitCard(string cardName, string bank, string owner, DateTime valid, int number)
        {
            DebitCard dc = new DebitCard(cardName, bank, owner, valid, number);

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