Example #1
0
        public void CalculateIncome_YearIsNullAndDoNotInclude_Returns35()
        {
            // Arrange
            decimal            target      = 15 + 20;
            string             firstId     = "ScooterOne";
            string             secondId    = "ScooterTwo";
            decimal            price       = 0.5m;
            IList <RentedUnit> rentHistory = new List <RentedUnit>
            {
                new RentedUnit(1, firstId, DateTime.Now, price),
                new RentedUnit(2, secondId, DateTime.Now, price)
            };

            // Act
            _calculations.ScooterService.AddScooter(firstId, price);
            _calculations.ScooterService.AddScooter(secondId, price);
            _calculations.ScooterService.GetScooterById(secondId).IsRented = true;
            rentHistory[0].StartTime  = new DateTime(2021, 5, 12, 23, 30, 0);
            rentHistory[0].EndTime    = new DateTime(2021, 5, 13, 1, 0, 0);
            rentHistory[0].TotalPrice = _calculations.CalculatePrice(rentHistory[0]);
            // Assert
            Assert.AreEqual(target, _calculations.CalculateIncome(null, false, rentHistory));
        }