예제 #1
0
        public override bool Equals(System.Object otherSpecies)
        {
            if (!(otherSpecies is Species))
            {
                return(false);
            }
            else
            {
                Species newSpecies   = (Species)otherSpecies;
                bool    idEquality   = (this.GetSpeciesId() == newSpecies.GetSpeciesId());
                bool    typeEquality = (this.GetType() == newSpecies.GetType());

                return(idEquality && typeEquality);
            }
        }
예제 #2
0
        public void Test_Update_UpdatesSpeciesInDatabase()
        {
            //Arrange
            string  testType    = "Cat";
            Species testSpecies = new Species(testType);

            testSpecies.Save();
            string newType = "Mouse";

            //Act
            testSpecies.Update(newType);

            string result = testSpecies.GetType();

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