Example #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);
        }
Example #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);
        }
Example #3
0
 public void CalculateBudgetShouldAddTheWeekendExtraForEachSaturday()
 {
     var friday = new DateTime(2014, 4, 11);
     var saturday = new DateTime(2014, 4, 12);
     var sunday = new DateTime(2014, 4, 13);
     var db = new LittleDB("newYorkTryp");
     var newyorkExpenses = new Tryp(db);
     newyorkExpenses.Initialize(friday, 10, 3);
     var daysToUpdate = new List<DateTime>(){friday, saturday, sunday};
     newyorkExpenses.CalculateBudgetForDays(daysToUpdate).ShouldBeEquivalentTo(33);
 }
Example #4
0
        public void ItShouldThrowAnExceptionIfAlreadyInitialized()
        {
            var today = DateTime.Today;
            var db = new LittleDB("newYorkTryp");
            var newyorkExpenses = new Tryp(db);

            newyorkExpenses.Initialize(today, 20, 10);
            Assert.Throws<InvalidOperationException>(() => newyorkExpenses.Initialize(today, 20, 10));
        }
Example #5
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);
        }