示例#1
1
        public void CanBeInitialized()
        {
            var db = new LittleDB("newYorkTryp");
            var newYorkExpenses = new Tryp(db);
            var today = DateTime.Now;
            newYorkExpenses.Initialize(today, 50, 0);

            newYorkExpenses.GetBudget().Total.Should().Be(50);
            newYorkExpenses.GetBudget().Daily.Should().Be(50);
        }
示例#2
0
        public void EachTimeIInstantiateItShouldUpdateTheTotalBudgetBasedOnDays()
        {
            var twoDaysAgo = DateTime.Today.AddDays(-2);
            var db = new LittleDB("newYorkTryp");
            var newyorkExpenses = new Tryp(db);
            newyorkExpenses.Initialize(twoDaysAgo, 20, 0);

            newyorkExpenses.GetBudget().Total.ShouldBeEquivalentTo(60);
        }
示例#3
0
        public void ItShoulndAddBudgetByDaysAlreadyCounted()
        {
            var twoDaysAgo = DateTime.Today.AddDays(-2);
            var db = new LittleDB("newYorkTryp");
            var newyorkExpenses = new Tryp(db);

            newyorkExpenses.Initialize(twoDaysAgo, 20, 0);
            newyorkExpenses.GetBudget().Total.ShouldBeEquivalentTo(60);
            var anotherInstance = new Tryp(db);
            anotherInstance.GetBudget().Total.ShouldBeEquivalentTo(60);
        }
示例#4
0
        public void ItShouldUpdateTheBudgetonInstance()
        {
            var db = new LittleDB("newYorkTryp");

            var threeDaysAgo = DateTime.Today.AddDays(-3);
            var twoDaysAgo = DateTime.Today.AddDays(-2);
            db.SaveList(new List<DateTime>(){threeDaysAgo, twoDaysAgo});

            var budget = new Budget {Daily = 20, Id = 1, Total = 40};
            db.Save(budget);

            var newyorkExpenses = new Tryp(db);
            newyorkExpenses.GetBudget().Total.ShouldBeEquivalentTo(80);
        }