public void Test_Find_FindsParasiteInDatabase()
        {
            // Arrange
            Parasite testParasite = new Parasite("Pencilvestyr");

            testParasite.Save();
            // Act
            Parasite foundParasite = Parasite.Find(testParasite.GetId());

            // Assert
            Assert.Equal(testParasite, foundParasite);
        }
Esempio n. 2
0
 public override bool Equals(System.Object otherParasite)
 {
     if (!(otherParasite is Parasite))
     {
         return(false);
     }
     else
     {
         Parasite newParasite  = (Parasite)otherParasite;
         bool     idEquality   = (this.GetId() == newParasite.GetId());
         bool     nameEquality = (this.GetName() == newParasite.GetName());
         return(idEquality && nameEquality);
     }
 }
        public void Test_Save_AssignsIdToObject()
        {
            //Arrange
            Parasite testParasite = new Parasite("Hamurai");

            //Act
            testParasite.Save();
            Parasite savedParasite = Parasite.GetAll()[0];

            int result = savedParasite.GetId();
            int testId = testParasite.GetId();

            //Assert
            Assert.Equal(testId, result);
        }