A Ledger Bucket that allows funds to accumulate from month to month. Only spending or Ledger Book Transfers will remove funds from this ledger.
Inheritance: LedgerBucket
Exemplo n.º 1
0
        public void DictionaryTest()
        {
            LedgerBucket instance1 = LedgerBookTestData.HairLedger;

            var dictionary = new Dictionary<LedgerBucket, LedgerBucket>
            {
                { instance1, instance1 }
            };

            LedgerBucket instance2 = new SavedUpForLedger
            {
                BudgetBucket = StatementModelTestData.HairBucket,
                StoredInAccount = LedgerBookTestData.ChequeAccount
            };

            // Should already contain this, its the same code.
            Assert.IsTrue(dictionary.ContainsKey(instance2));

            LedgerBucket instance3 = new SavedUpForLedger
            {
                BudgetBucket = new SavedUpForExpenseBucket("HAIRCUT", "Foo bar"),
                StoredInAccount = LedgerBookTestData.ChequeAccount
            };

            Assert.IsTrue(dictionary.ContainsKey(instance3));
        }
Exemplo n.º 2
0
 public void TwoInstancesWithSameBucketAndAccountAreEqual()
 {
     var instance1 = new SavedUpForLedger
     {
         BudgetBucket = StatementModelTestData.CarMtcBucket,
         StoredInAccount = StatementModelTestData.SavingsAccount
     };
     var instance2 = new SavedUpForLedger
     {
         BudgetBucket = StatementModelTestData.CarMtcBucket,
         StoredInAccount = StatementModelTestData.SavingsAccount
     };
     Assert.AreEqual(instance1, instance2);
     Assert.IsTrue(instance1 == instance2);
 }
        public void IsValid_ShouldBeFalse_GivenLedgersAreTheSame()
        {
            var ledger = new SavedUpForLedger
            {
                BudgetBucket = StatementModelTestData.InsHomeBucket,
                StoredInAccount = StatementModelTestData.ChequeAccount
            };
            this.subject = new TransferFundsCommand
            {
                FromLedger = ledger,
                ToLedger = ledger,
                Narrative = "Foo",
                TransferAmount = 1
            };

            Assert.IsFalse(this.subject.IsValid());
        }
Exemplo n.º 4
0
 static LedgerBookTestData()
 {
     ChequeAccount = StatementModelTestData.ChequeAccount;
     SavingsAccount = StatementModelTestData.SavingsAccount;
     RatesLedger = new SavedUpForLedger { BudgetBucket = new SavedUpForExpenseBucket(TestDataConstants.RatesBucketCode, "Rates "), StoredInAccount = ChequeAccount };
     PowerLedger = new SpentMonthlyLedger { BudgetBucket = new SpentMonthlyExpenseBucket(TestDataConstants.PowerBucketCode, "Power "), StoredInAccount = ChequeAccount };
     PhoneLedger = new SpentMonthlyLedger { BudgetBucket = new SpentMonthlyExpenseBucket(TestDataConstants.PhoneBucketCode, "Poo bar"), StoredInAccount = ChequeAccount };
     WaterLedger = new SpentMonthlyLedger { BudgetBucket = new SpentMonthlyExpenseBucket(TestDataConstants.WaterBucketCode, "Poo bar"), StoredInAccount = ChequeAccount };
     HouseInsLedger = new SpentMonthlyLedger { BudgetBucket = new SpentMonthlyExpenseBucket(TestDataConstants.InsuranceHomeBucketCode, "Poo bar"), StoredInAccount = ChequeAccount };
     HouseInsLedgerSavingsAccount = new SavedUpForLedger { BudgetBucket = new SavedUpForExpenseBucket(TestDataConstants.InsuranceHomeBucketCode, "Poo bar"), StoredInAccount = SavingsAccount };
     CarInsLedger = new SavedUpForLedger { BudgetBucket = new SavedUpForExpenseBucket("INSCAR", "Poo bar"), StoredInAccount = ChequeAccount };
     LifeInsLedger = new SavedUpForLedger { BudgetBucket = new SavedUpForExpenseBucket("INSLIFE", "Poo bar"), StoredInAccount = ChequeAccount };
     CarMtcLedger = new SavedUpForLedger { BudgetBucket = new SavedUpForExpenseBucket(TestDataConstants.CarMtcBucketCode, "Poo bar"), StoredInAccount = ChequeAccount };
     RegoLedger = new SavedUpForLedger { BudgetBucket = new SavedUpForExpenseBucket(TestDataConstants.RegoBucketCode, ""), StoredInAccount = ChequeAccount };
     HairLedger = new SavedUpForLedger { BudgetBucket = new SavedUpForExpenseBucket(TestDataConstants.HairBucketCode, "Hair cuts wheelbarrow."), StoredInAccount = ChequeAccount };
     ClothesLedger = new SavedUpForLedger { BudgetBucket = new SavedUpForExpenseBucket("CLOTHES", ""), StoredInAccount = ChequeAccount };
     DocLedger = new SavedUpForLedger { BudgetBucket = new SavedUpForExpenseBucket(TestDataConstants.DoctorBucketCode, ""), StoredInAccount = ChequeAccount };
     SurplusLedger = new SurplusLedger { StoredInAccount = ChequeAccount };
     SavingsSurplusLedger = new SurplusLedger { StoredInAccount = SavingsAccount };
     SavingsLedger = new SavedUpForLedger { BudgetBucket = new SavedUpForExpenseBucket(TestDataConstants.SavingsBucketCode, "Savings"), StoredInAccount = ChequeAccount };
 }
Exemplo n.º 5
0
 public void TwoInstancesWithSameBucketAndNullAccountHaveTheSameHashCode()
 {
     var instance1 = new SavedUpForLedger
     {
         BudgetBucket = StatementModelTestData.CarMtcBucket,
         StoredInAccount = null
     };
     var instance2 = new SavedUpForLedger
     {
         BudgetBucket = StatementModelTestData.CarMtcBucket,
         StoredInAccount = null
     };
     Assert.AreEqual(instance1.GetHashCode(), instance2.GetHashCode());
 }