Esempio n. 1
0
        public void CantRentIfLate()
        {
            idtMock.Now().Returns(new DateTime(2010, 10, 10));

            sut.AddRental("Rambo", "1992-11-01");

            idtMock.Now().Returns(new DateTime(2010, 10, 10).AddDays(4));

            Assert.Throws <DueDateExpiredExeption>(() => sut.AddRental("Rambo2", "1992-11-01"));
        }
Esempio n. 2
0
        public void GetThreeDays()
        {
            idtMock.Now().Returns(new DateTime(2010, 10, 10));

            DateTime theTime = idtMock.Now().AddDays(3);

            sut.RegisterCustomer("Riakrd Persson", "1992-11-01");

            sut.AddMovie(new Movie()
            {
                Director = "Director",
                Title    = "MovieTitle",
                Genre    = "MovieGenre"
            });

            sut.RentMovie("Riakrd Persson", "MovieTitle");

            Assert.AreEqual(theTime, sut.GetRental("Riakrd Persson", "MovieTitle").Due_Date);
        }
Esempio n. 3
0
        public void AddRental(string movieTitle, string socialSecurityNumber)
        {
            bool vvv = rent.Any(x => x.socialSecurityNumber.Equals(socialSecurityNumber) && x.Due_Date < Idt.Now());

            if (vvv)
            {
                throw new DueDateExpiredExeption();
            }

            rent.Add(new Rental()
            {
                socialSecurityNumber = socialSecurityNumber,
                Due_Date             = Idt.Now().AddDays(3),
                Movie_Title          = movieTitle
            });
        }