コード例 #1
0
 public Library CheckOutBook(Book book, Student student, DateTime checkedOutDate)
 {
     var result = new Library();
     result.ExpectedReturnDate = checkedOutDate.AddMonths(1);
     result.CheckOutDate = checkedOutDate;
     return result;
 }
コード例 #2
0
        public Library CheckInBook(Book book, DateTime droppedOffDate)
        {
            var result = new Library();
            result.ExpectedReturnDate = null;
            result.ActualReturnDate = droppedOffDate;

                return result;
        }
コード例 #3
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);
        }
コード例 #4
0
        public void CheckedInBookDatesSetDates()
        {
            //Arrange
            LibraryManager mgr = new LibraryManager();
            DateTime droppedOffDate = new DateTime(2015, 5, 1);
            Book book = new Book();

            //Act
            Library result = mgr.CheckInBook(book, droppedOffDate);

            //Asserts
            Assert.IsNull(result.ExpectedReturnDate);
            Assert.AreEqual(droppedOffDate, result.ActualReturnDate);
        }