Exemple #1
0
        public void EntitiesWithComplexIds_WhenNotEqual_HashCodesNotEqual()
        {
            // Arrange
            var e1 = new FakeEntityWithComplexId(new FakeId(DateTime.Parse("08-19-2018")));
            var e2 = new FakeEntityWithComplexId(new FakeId(DateTime.Parse("08-18-2018")));

            // Act
            var hashCodesEqual = e1.GetHashCode() == e2.GetHashCode();

            // Assert
            hashCodesEqual.Should().BeFalse();
        }
Exemple #2
0
        public void GetTheIdValue()
        {
            // Arrange
            var expectedId = new FakeId(DateTime.Parse("08-18-2018 18:03:00"));
            var fakeEntity = new FakeEntityWithComplexId(expectedId);

            // Act
            var id = fakeEntity.Id;

            // Assert
            id.Value.Should().Be(expectedId.Value);
        }
Exemple #3
0
        public void EntitiesWithComplexIds_AreNotEqual()
        {
            // Arrange
            var e1 = new FakeEntityWithComplexId(new FakeId(DateTime.Parse("08-19-2018")));
            var e2 = new FakeEntityWithComplexId(new FakeId(DateTime.Parse("08-18-2018")));

            // Act
            var areEqual = e1 == e2;

            // Assert
            areEqual.Should().BeFalse();
        }