コード例 #1
0
        public void EqualsWithOneNullObjectReturnFalse()
        {
            const SimpleDomainObject obj1 = null;
            var obj2 = new SimpleDomainObject();

            var equality = Equals(obj1, obj2);
            Assert.AreEqual(false, equality);
        }
コード例 #2
0
        public void EqualsWithOneTransientObjectReturnsFalse()
        {
            var obj1 = new SimpleDomainObject();
            var obj2 = new SimpleDomainObject();
            obj2.SetId(1);

            var equality = Equals(obj1, obj2);
            Assert.AreEqual(false, equality);
        }
コード例 #3
0
        public void EqualsWithDifferentIdsReturnsFalse()
        {
            var obj1 = new SimpleDomainObject();
            var obj2 = new SimpleDomainObject();
            obj1.SetId(1);
            obj2.SetId(2);

            var equality = Equals(obj1, obj2);
            Assert.AreEqual(false, equality);
        }
コード例 #4
0
        public void EqualsWithDifferentIdsInDisparateClassesReturnsFalse()
        {
            var obj1 = new SimpleDomainObject();
            var obj2 = new OtherDomainObject();
            obj1.SetId(1);
            obj2.SetId(2);

            bool equality = Equals(obj1, obj2);
            Assert.AreEqual(false, equality);
        }
コード例 #5
0
        public void PersistSimpleDomainObject()
        {
            var simpleDomainObject = new SimpleDomainObject { Name = "Hello World." };
            var simpleRepository = new RepositoryWithIntId<SimpleDomainObject>(Session);
            using (var transaction = Session.BeginTransaction())
            {
                simpleRepository.Insert(simpleDomainObject);
                transaction.Commit();
            }

            Assert.IsNotNull(simpleDomainObject.Id);
        }
コード例 #6
0
        public void EqualsWithTwoTransientObjectsThatAreTheSameReferenceReturnsTrue()
        {
            var obj1 = new SimpleDomainObject();
            var obj2 = obj1;

            var equality = Equals(obj1, obj2);
            Assert.AreEqual(true, equality);
        }
コード例 #7
0
        public void EqualsWithSameIdsReturnsTrue()
        {
            var obj1 = new SimpleDomainObject();
            var obj2 = new SimpleDomainObject();
            obj1.SetId(1);
            obj2.SetId(1);

            var equality = Equals(obj1, obj2);
            Assert.AreEqual(true, equality);
        }