Example #1
0
        public List <Book> GetCheckouts(List <Copy> copies)
        {
            List <Book> checkouts = new List <Book> {
            };

            foreach (Copy Copy in copies)
            {
                Book newBook = Book.Find(Copy.GetBookId());
                checkouts.Add(newBook);
            }
            return(checkouts);
        }
Example #2
0
        public void T6_Update_UpdatesCopyInDB()
        {
            Copy testCopy = new Copy(1);

            testCopy.Save();

            int newBookId = 2;

            testCopy.Update(newBookId);

            int resultBookId = testCopy.GetBookId();

            Assert.Equal(newBookId, resultBookId);
        }
Example #3
0
 public override bool Equals(System.Object otherCopy)
 {
     if (!(otherCopy is Copy))
     {
         return(false);
     }
     else
     {
         Copy newCopy           = (Copy)otherCopy;
         bool idEquality        = (this.GetId() == newCopy.GetId());
         bool bookIdEquality    = (this.GetBookId() == newCopy.GetBookId());
         bool availableEquality = (this.GetAvailability() == newCopy.GetAvailability());
         return(idEquality && bookIdEquality && availableEquality);
     }
 }
Example #4
0
        public override bool Equals(System.Object otherCopy)
        {
            if (!(otherCopy is Copy))
            {
                return(false);
            }
            else
            {
                Copy newCopy        = (Copy)otherCopy;
                bool idEquality     = this.GetId() == newCopy.GetId();
                bool BookIdEquality = this.GetBookId() == newCopy.GetBookId();

                return(idEquality && BookIdEquality);
            }
        }
Example #5
0
        public override bool Equals(System.Object otherCopy)
        {
            if (!(otherCopy is Copy))
            {
                return(false);
            }
            else
            {
                Copy newCopy          = (Copy)otherCopy;
                bool bookIdEquality   = (this.GetBookId() == newCopy.GetBookId());
                bool numberOfEquality = (this.GetNumberOf() == newCopy.GetNumberOf());
                bool dueDateEquality  = (this.GetDueDate() == newCopy.GetDueDate());


                return(bookIdEquality && numberOfEquality && dueDateEquality);
            }
        }
Example #6
0
        public void AddCopy_OneCopy_PatronAndNewCopy()
        {
            Patron testPatron = new Patron("Britton");

            testPatron.Save();

            Copy newCopy = new Copy(1, 15);

            newCopy.Save();

            testPatron.AddCopy(newCopy);

            List <Copy> allCopies  = testPatron.GetCopy();
            int         checkedOut = allCopies[0].GetBookId();

            int expected = newCopy.GetBookId();

            Assert.Equal(expected, checkedOut);
        }
Example #7
0
        public void T6_Update_UpdatesCopyInDB()
        {
            Copy testCopy = new Copy(1);
              testCopy.Save();

              int newBookId = 2;

              testCopy.Update(newBookId);

              int resultBookId = testCopy.GetBookId();

              Assert.Equal(newBookId, resultBookId);
        }