public void testEqualsAndSameAs() { DateTime timeOccured = DateTime.Now; DateTime timeRegistered = DateTime.Now; HandlingEvent ev1 = new HandlingEvent(cargo, timeOccured, timeRegistered, HandlingActivityType.LOAD, L.CHICAGO, SampleVoyages.atlantic1, new OperatorCode("ABCDE")); HandlingEvent ev2 = new HandlingEvent(cargo, timeOccured, timeRegistered, HandlingActivityType.LOAD, L.CHICAGO, SampleVoyages.atlantic1, new OperatorCode("ABCDE")); Assert.IsTrue(ev1.Equals(ev2)); Assert.IsTrue(ev2.Equals(ev1)); Assert.IsTrue(ev1.Equals(ev1)); //noinspection ObjectEqualsNull Assert.IsFalse(ev2.Equals(null)); Assert.IsFalse(ev2.Equals(new object())); }
public void TestEqualsAndSameAs() { var timeOccured = new DateTime(); var timeRegistered = new DateTime(); var ev1 = new HandlingEvent(cargo, timeOccured, timeRegistered, HandlingType.LOAD, SampleLocations.CHICAGO, SampleVoyages.CM005); var ev2 = new HandlingEvent(cargo, timeOccured, timeRegistered, HandlingType.LOAD, SampleLocations.CHICAGO, SampleVoyages.CM005); // Two handling events are not equal() even if all non-uuid fields are identical Assert.IsTrue(ev1.Equals(ev2)); Assert.IsTrue(ev2.Equals(ev1)); Assert.IsTrue(ev1.Equals(ev1)); Assert.IsFalse(ev2.Equals(null)); Assert.IsFalse(ev2.Equals(new Object())); }