public void NotEqualWhenIdsAreDifferent() { var role = RoleTestHelper.PendingRegistration().WithId(11).Build(); var left = new RoleCreated(role, new UserId(3), new DomainEventId(1), _clock.UtcNow()); var right = new RoleCreated(role, new UserId(3), new DomainEventId(2), _clock.UtcNow()); left.Equals((object)right).Should().BeFalse(); left.Equals(right).Should().BeFalse(); (left == right).Should().BeFalse(); (left != right).Should().BeTrue(); }
public void NotEqualWhenTheOtherIsNull() { var role = RoleTestHelper.PendingRegistration().WithId(11).Build(); var left = new RoleCreated(role, new UserId(4), new DomainEventId(1), _clock.UtcNow()); RoleCreated?right = null; left.Equals(right as object).Should().BeFalse(); left.Equals(right).Should().BeFalse(); (left == right).Should().BeFalse(); (left != right).Should().BeTrue(); (right == left).Should().BeFalse(); (right != left).Should().BeTrue(); }
public void EqualWhenIdsAreEqual() { var pendingRole = RoleTestHelper.PendingRegistration().WithId(11).Build(); var left = new RoleCreated(pendingRole, new UserId(1), new DomainEventId(1), _clock.UtcNow()); var registeredRole = RoleTestHelper.RegisteredUser().WithId(12).Build(); var right = new RoleCreated(registeredRole, new UserId(2), new DomainEventId(1), _clock.UtcNow()); left.Equals((object)right).Should().BeTrue(); left.Equals(right).Should().BeTrue(); (left == right).Should().BeTrue(); (left != right).Should().BeFalse(); left.GetHashCode().Should().Be(right.GetHashCode()); }