예제 #1
0
 public override bool Equals(System.Object otherCategory)
 {
     if (!(otherCategory is Category))
     {
         return(false);
     }
     else
     {
         Category newCategory  = (Category)otherCategory;
         bool     idEquality   = this.GetId() == newCategory.GetId();
         bool     nameEquality = this.GetName() == newCategory.GetName();
         return(idEquality && nameEquality);
     }
 }
예제 #2
0
        public void Test_Update_UpdatesCategoryInDatabase()
        {
            //Arrange
            string   name         = "Home stuff";
            Category testCategory = new Category(name);

            testCategory.Save();
            string newName = "Work stuff";

            //Act
            testCategory.Update(newName);

            string result = testCategory.GetName();

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