Exemple #1
0
 public override bool Equals(System.Object otherCheckout)
 {
     if (!(otherCheckout is Checkout))
     {
         return(false);
     }
     else
     {
         Checkout newCheckout      = (Checkout)otherCheckout;
         bool     idEquality       = this.GetId() == newCheckout.GetId();
         bool     dueDateEquality  = this.GetDueDate() == newCheckout.GetDueDate();
         bool     patronIdEquality = this.GetPatronId() == newCheckout.GetPatronId();
         bool     bookIdEquality   = this.GetBookId() == newCheckout.GetBookId();
         return(idEquality && dueDateEquality && patronIdEquality && bookIdEquality);
     }
 }
Exemple #2
0
 public override bool Equals(System.Object otherCheckout)
 {
     if (!(otherCheckout is Checkout))
     {
         return(false);
     }
     else
     {
         Checkout newCheckout      = (Checkout)otherCheckout;
         bool     idEquality       = (this.GetId() == newCheckout.GetId());
         bool     copyIdEquality   = (this.GetCopyId() == newCheckout.GetCopyId());
         bool     patronIdEquality = (this.GetPatronId() == newCheckout.GetPatronId());
         bool     dueEquality      = (this.GetDueDate() == newCheckout.GetDueDate());
         bool     checkInEquality  = (this.GetCheckInStatus() == newCheckout.GetCheckInStatus());
         return(idEquality && copyIdEquality && patronIdEquality && dueEquality && checkInEquality);
     }
 }
Exemple #3
0
        public void Update_UpdateInDatabase_true()
        {
            //Arrange
            Author newAuthor = new Author("Ernest Hemingway");
            newAuthor.Save();
            Book newBook = new Book("Old Man and the Sea", 5);
            newBook.Save();
            newBook.AddAuthor(newAuthor.GetId());
            Patron newPatron = new Patron("Johnny English", "555-555-5555");
            newPatron.Save();

            Checkout newCheckout = new Checkout("2017/05/1", newPatron.GetId(), newBook.GetId());
            newCheckout.Save(newBook);
            //Act
            newCheckout.Update("2017/06/12");
            string result = newCheckout.GetDueDate();

            //Assert
            Assert.Equal("2017/06/12", result);
            // Assert.Equal(newName, result.GetName());
        }