Exemple #1
0
        public void CheckSavings_05_ChecksIfListIsEmpty_ReturnFalse()
        {
            var emptyList = new List <Saving>();
            var actual    = Saving.CheckSavings(emptyList);

            Assert.IsFalse(actual);
        }
Exemple #2
0
        public void CheckSavings_01_ChecksSuccessfulWithdraw_ReturnTrue()
        {
            bc.WithdrawEachExpense(BudgetCalculator.listOfEconomy);
            var actual = Saving.CheckSavings(BudgetCalculator.savingsList);

            Assert.IsTrue(actual);
        }
Exemple #3
0
        public void CheckSavings_02_ChecksUnsuccessfulWithdraw_ReturnFalse()
        {
            bc.WithdrawEachExpense(BudgetCalculator.listOfEconomy);
            BudgetCalculator.totalIncome.Money = 0;
            var actual = Saving.CheckSavings(BudgetCalculator.savingsList);

            Assert.IsFalse(actual);
        }
Exemple #4
0
        public void CheckSavings_07_ChecksIfListPropertyIsEmpty_ReturnFalse()
        {
            var emptyList = new List <Saving> {
                null
            };
            var actual = Saving.CheckSavings(emptyList);

            Assert.IsFalse(actual);
        }
Exemple #5
0
        public void CheckSavings_04_ChecksIfListIsNull_ReturnFalse()
        {
            var nullList = new List <Saving>();

            nullList = null;
            var actual = Saving.CheckSavings(nullList);

            Assert.IsFalse(actual);
        }
Exemple #6
0
        public void CheckSavings_06_ChecksIfListPropertyIsEmpty_ReturnTrue()
        {
            var emptyList = new List <Saving> {
                new Saving {
                    Name = null, SavingsPercentage = 0.1
                }
            };
            var actual = Saving.CheckSavings(emptyList);

            Assert.IsTrue(actual);
        }
Exemple #7
0
        public void CheckSavings_03_ChecksIfPercentageIsOverMaxPercentage_ReturnEqual()
        {
            bc.WithdrawEachExpense(BudgetCalculator.listOfEconomy);
            BudgetCalculator.savingsList.Add(new Saving {
                Name = "Error", SavingsPercentage = 1.1
            });
            var actual   = Saving.CheckSavings(BudgetCalculator.savingsList);
            var expected = BudgetCalculator.totalIncome.Money >= 0;

            Assert.AreEqual(actual, expected);
        }
        public void LogAll_01_CheckIfItemAddsToList()
        {
            var bc = new BudgetCalculator();

            bc.SeparateIncomeAndExpense(BudgetCalculator.listOfEconomy);
            bc.WithdrawEachExpense(BudgetCalculator.listOfEconomy);
            Saving.CheckSavings(BudgetCalculator.savingsList);
            log.listToPrint.Add("(test)");
            log.LogAll();
            var actual   = log.listToPrint.Find(e => e.Contains("(test)"));
            var expected = "(test)";

            Assert.AreEqual(actual, expected);
            log.listToPrint.Clear();
        }