Example #1
0
        public void SameInstanceIsEqual()
        {
            var bar = new EntityWithGuidPrimaryKey {
                Id = Guid.NewGuid()
            };

            Assert.True(bar.Equals(bar));
        }
Example #2
0
        public void NonSamePrimaryKeyNotEqual()
        {
            var bar = new EntityWithGuidPrimaryKey {
                Id = Guid.NewGuid()
            };
            var otherBar = new EntityWithGuidPrimaryKey {
                Id = Guid.NewGuid()
            };

            Assert.False(bar.Equals(otherBar));
            Assert.False(otherBar.Equals(bar));
        }
Example #3
0
        public void SamePrimaryKeyEqual()
        {
            var guid = Guid.NewGuid();
            var bar  = new EntityWithGuidPrimaryKey {
                Id = guid
            };
            var otherBar = new EntityWithGuidPrimaryKey {
                Id = guid
            };

            Assert.True(bar.Equals(otherBar));
            Assert.True(otherBar.Equals(bar));
        }
Example #4
0
        public void EqualsNonBarIsFalse()
        {
            var bar = new EntityWithGuidPrimaryKey();

            Assert.False(bar.Equals(new Foo()));
        }
Example #5
0
        public void EqualsNullIsFalse()
        {
            var bar = new EntityWithGuidPrimaryKey();

            Assert.False(bar.Equals(null));
        }