コード例 #1
0
        public void Clone_CopiesChangesProperly()
        {
            var instance1 = new MyTable();

            instance1.MyNumber = 2;

            var instance2 = instance1.Clone();

            Assert.AreEqual(1, instance2.Entity.Changes.Count());
            Assert.IsTrue(instance2.Entity.Changes.Contains("MyNumber"));
        }
コード例 #2
0
        public void Clone_CopiesTimestampsProperly()
        {
            var instance1 = new MyTable();

            instance1.Entity.Reset();
            instance1.MyNumber = 2;

            var instance2 = instance1.Clone();

            Assert.AreEqual(instance1.Entity.LastModified, instance2.Entity.LastModified);
            Assert.AreEqual(instance1.Entity.LastUpdated, instance2.Entity.LastUpdated);
        }
コード例 #3
0
        public void Clone_CopiesAllPropertiesProperly()
        {
            var instance1 = new MyTable();

            instance1.MyIdentity = 1;
            instance1.MyNumber   = 2;
            instance1.MyString   = "3";

            var instance2 = instance1.Clone();

            Assert.AreEqual(instance1.MyIdentity, instance2.MyIdentity);
            Assert.AreEqual(instance1.MyNumber, instance2.MyNumber);
            Assert.AreEqual(instance1.MyString, instance2.MyString);
        }
コード例 #4
0
        public void Clone_CopiesStateProperly()
        {
            var instance1 = new MyTable();

            instance1.Entity.Reset();

            Assert.AreEqual(EntityState.Current, instance1.Entity.State);

            instance1.MyNumber = 2;

            Assert.AreEqual(EntityState.Modified, instance1.Entity.State);

            var instance2 = instance1.Clone();

            Assert.AreEqual(EntityState.Modified, instance2.Entity.State);
        }