public void KnowWhenItWasUsedToPaid()
        {
            int       paymentTotal = 1100;
            DateTime  oneDate      = DateTime.Parse("10/10/2010");
            PayMethod payMethod    = new DebitPayMethod(oneDate);

            Assert.AreEqual(oneDate, payMethod.PayDate);
        }
        public void HaveMinimumOneReceipt()
        {
            PayMethod      paymentMethod = new DebitPayMethod(DateTime.Now);
            List <Receipt> receipts      = new List <Receipt>();

            int     amountPayed = 7500;
            Payment newPayment  = new Payment(paymentMethod, amountPayed, receipts);
        }
        public void NotHaveNullReceipts()
        {
            int                   amountPayed   = 500;
            PayMethod             paymentMethod = new DebitPayMethod(DateTime.Now);
            ICollection <Receipt> receipts      = null;

            Payment newPayment = new Payment(paymentMethod, amountPayed, receipts);
        }
        public void RefusePaymentWhenTotalIsNegative()
        {
            int       paymentTotal = -1;
            int       payedWith    = 0;
            DateTime  oneDate      = DateTime.Parse("12/12/2009");
            PayMethod payMethod    = new DebitPayMethod(oneDate);

            payMethod.PayAndReturnChange(paymentTotal, payedWith);
        }
        public void BeAbleToPayAndReturn0Change()
        {
            int       paymentTotal = 1000;
            int       payedWith    = 1000;
            DateTime  todaysDate   = DateTime.Now;
            PayMethod payMethod    = new DebitPayMethod(todaysDate);

            double change = payMethod.PayAndReturnChange(paymentTotal, payedWith);

            Assert.AreEqual(0, change);
        }
        private Payment CreatePayment()
        {
            PayMethod     paymentMethod  = new DebitPayMethod(DateTime.Today);
            List <IField> emptyFieldList = new List <IField>();
            NumberField   aNumberField   = new NumberField("Numerito");

            emptyFieldList.Add(aNumberField);
            Provider      provider             = new Provider("Antel", 20, emptyFieldList);
            IField        aCompleteNumberField = aNumberField.FillAndClone("1234");
            List <IField> completeFieldList    = new List <IField>();

            completeFieldList.Add(aCompleteNumberField);
            double         amount   = 10000;
            Receipt        receipt  = new Receipt(provider, completeFieldList, amount);
            List <Receipt> receipts = new List <Receipt>();

            receipts.Add(receipt);
            int amountPayed = 10000;

            return(new Payment(paymentMethod, amountPayed, receipts));
        }
        public void BeAbleToAddAllEarningsToExistingDictionaryOfEarningsPerProviderGivenFromAndToDates()
        {
            IDictionary <Provider, double> earningsPerProvider = new Dictionary <Provider, double>();
            PayMethod     paymentMethod  = new DebitPayMethod(DateTime.Today);
            List <IField> emptyFieldList = new List <IField>();
            NumberField   aNumberField   = new NumberField("Numerito");

            emptyFieldList.Add(aNumberField);
            Provider      provider             = new Provider("Antel", 20, emptyFieldList);
            IField        aCompleteNumberField = aNumberField.FillAndClone("1234");
            List <IField> completeFieldList    = new List <IField>();

            completeFieldList.Add(aCompleteNumberField);
            double         amount   = 10000;
            Receipt        receipt  = new Receipt(provider, completeFieldList, amount);
            List <Receipt> receipts = new List <Receipt>();

            receipts.Add(receipt);
            int     amountPayed = 10000;
            Payment newPayment  = new Payment(paymentMethod, amountPayed, receipts);
            IDictionary <Provider, double> expectedDictionary = new Dictionary <Provider, double>();

            expectedDictionary.Add(provider, 2000);

            newPayment.AddThisPaymentsEarningsToDictionary(earningsPerProvider, DateTime.Today, DateTime.Today);

            bool result = true;

            foreach (KeyValuePair <Provider, double> pair in expectedDictionary)
            {
                if (!earningsPerProvider.Contains(pair))
                {
                    result = false;
                }
            }
            Assert.IsTrue(result);
        }
        public void HavePositiveAmountPayed()
        {
            PayMethod     paymentMethod  = new DebitPayMethod(DateTime.Now);
            List <IField> emptyFieldList = new List <IField>();
            NumberField   aNumberField   = new NumberField("Numerito");

            emptyFieldList.Add(aNumberField);

            Provider provider = new Provider("Antel", 20, emptyFieldList);

            IField        aCompleteNumberField = aNumberField.FillAndClone("1234");
            List <IField> completeFieldList    = new List <IField>();

            completeFieldList.Add(aCompleteNumberField);
            double  amount  = 10000;
            Receipt receipt = new Receipt(provider, completeFieldList, amount);

            List <Receipt> receipts = new List <Receipt>();

            receipts.Add(receipt);

            int     amountPayed = -1000;
            Payment newPayment  = new Payment(paymentMethod, amountPayed, receipts);
        }
 public void NotHaveAFutureDate()
 {
     DateTime  futureDate = DateTime.Now.AddYears(1);
     PayMethod payMethod  = new DebitPayMethod(futureDate);
 }