public Library CheckOutBook(Book book, Student student, DateTime checkedOutDate)
 {
     var result = new Library();
     result.ExpectedReturnDate = checkedOutDate.AddMonths(1);
     result.CheckOutDate = checkedOutDate;
     return result;
 }
Esempio n. 2
0
        public void CheckedOutBookDatesSetCorrectly()
        {
            LibraryManager mgr = new LibraryManager();
            var checkoutdate = new DateTime(2005, 5, 5);

            var book = new Book();
            var student = new Student();
            Library result = mgr.CheckOutBook(book, student, checkoutdate);

            Assert.AreEqual(checkoutdate, result.CheckOutDate);
            Assert.AreEqual(checkoutdate.AddMonths(1), result.ExpectedReturnDate);
        }
Esempio n. 3
0
        public void CalculateAge()
        {
            Student bob = new Student();
            //bob.Name = "Bob Anderson";
            bob.DoB = new DateTime(1981, 6, 6);
            //formulate a dob based off today's date
            bob.DoB = DateTime.Now.AddDays(-365 * 45);

            LibraryManager mgr = new LibraryManager();
            mgr.AddStudent(bob);

            Assert.AreEqual(45, bob.Age);
        }
 public void AddStudent(Student s)
 {
     s.Age = s.Age = (int)(DateTime.Now.Subtract(s.DoB).TotalDays / 365);
 }