public void compare_two_equals_trades_test() { Trade first = new Trade(1, "ST12345-RF-01", "RTS-9.14", new DateTime(2014, 8, 26, 10, 0, 0), 125000, 10); Trade second = new Trade(1, "ST12345-RF-01", "RTS-9.14", new DateTime(2014, 8, 26, 10, 0, 0), 125000, 10); IEqualityComparer <Trade> comparer = new IdentifiedEqualityComparer(); Assert.IsTrue(comparer.Equals(first, second)); }
public void Orders_With_Same_Id_Are_Equals() { IdentifiedEqualityComparer <Order> iec = new IdentifiedEqualityComparer <Order>(); HashSet <Order> orders = new HashSet <Order>(iec); Order order = new Order { Id = 1 }; orders.Add(order); Assert.AreEqual(1, orders.Count); Order two = new Order { Id = 1 }; orders.Add(two); Assert.AreEqual(1, orders.Count); }