public void GetHashCode_One_Object() { var income = new Income { Amount = 120, Category = new IncomeCategory { Id = 0, Name = "Category" }, Comments = "Stuff", Date = DateTime.Today, Id = 0, Method = new PaymentMethod { Id = 0, Name = "Method" } }; Assert.AreEqual(income.GetHashCode(), income.GetHashCode()); }
public void GetHashCode_Two_Objects() { var first = new Income { Amount = 120, Category = new IncomeCategory { Id = 0, Name = "Category" }, Comments = "Stuff", Date = DateTime.Today, Id = 0, Method = new PaymentMethod { Id = 0, Name = "Method" } }; var second = new Income { Amount = 120, Category = new IncomeCategory { Id = 0, Name = "Category" }, Comments = "Stuff", Date = DateTime.Today, Id = 0, Method = new PaymentMethod { Id = 0, Name = "Method" } }; Assert.AreNotSame(first, second); Assert.AreNotEqual(first.GetHashCode(), second.GetHashCode()); }
public void GetHashCode_One_Object() { var Income = new Income { Amount = 120, Category = new IncomeCategory { Id = 0, Name = "Category" }, Comments = "Stuff", Date = DateTime.Today, Id = 0, Method = new PaymentMethod { Id = 0, Name = "Method" } }; Assert.AreEqual(Income.GetHashCode(), Income.GetHashCode()); }