Esempio n. 1
0
        public void Should_Ignore_ByAutoFieldPath()
        {
            var test = new BasicObject {
                BoolValue = true, ByteValue = 1, IntValue = 100, LongValue = 1000, StringValue = "A test string"
            };
            var clonedObject = test.Clone(".<StringValue>k__BackingField");

            Assert.AreEqual(test.BoolValue, clonedObject.BoolValue);
            Assert.AreEqual(test.ByteValue, clonedObject.ByteValue);
            Assert.AreEqual(test.IntValue, clonedObject.IntValue);
            Assert.AreEqual(test.LongValue, clonedObject.LongValue);
            Assert.IsNull(clonedObject.StringValue);
        }
Esempio n. 2
0
        public void Should_Ignore_ByPropertyExpression()
        {
            var test = new BasicObject {
                BoolValue = true, ByteValue = 1, IntValue = 100, LongValue = 1000, StringValue = "A test string"
            };
            var clonedObject = test.Clone(x => x.StringValue);

            Assert.AreEqual(test.BoolValue, clonedObject.BoolValue);
            Assert.AreEqual(test.ByteValue, clonedObject.ByteValue);
            Assert.AreEqual(test.IntValue, clonedObject.IntValue);
            Assert.AreEqual(test.LongValue, clonedObject.LongValue);
            Assert.IsNull(clonedObject.StringValue);
        }
Esempio n. 3
0
        public static void Should_Clone_BasicObject()
        {
            var original = new BasicObject
            {
                BoolValue   = true,
                ByteValue   = 0x10,
                IntValue    = 100,
                LongValue   = 10000,
                StringValue = "Test String"
            };
            BasicObject cloned = original.Clone();

            cloned.ShouldBe(original);
        }
Esempio n. 4
0
        public void Should_Clone_BasicObject()
        {
            var original = new BasicObject
            {
                BoolValue   = true,
                ByteValue   = 0x10,
                IntValue    = 100,
                LongValue   = 10000,
                StringValue = "Test String"
            };
            var cloned = original.Clone();

            Assert.AreEqual(original, cloned);
        }
Esempio n. 5
0
        public void Should_Ignore_ByFieldPath()
        {
            var test = new BasicObject(10)
            {
                BoolValue = true, ByteValue = 1, IntValue = 100, LongValue = 1000, StringValue = "A test string"
            };
            var clonedObject = test.Clone("._privateIntValue");

            Assert.AreNotEqual(test.GetFieldValue <int>("_privateIntValue"), clonedObject.GetFieldValue <int>("_privateIntValue"));
            Assert.AreEqual(test.BoolValue, clonedObject.BoolValue);
            Assert.AreEqual(test.ByteValue, clonedObject.ByteValue);
            Assert.AreEqual(test.IntValue, clonedObject.IntValue);
            Assert.AreEqual(test.LongValue, clonedObject.LongValue);
            Assert.AreEqual(test.StringValue, clonedObject.StringValue);
        }
Esempio n. 6
0
        public static void ModifiedClone_Basic_ShouldNotBeEqual()
        {
            var original = new BasicObject
            {
                BoolValue   = true,
                ByteValue   = 0x10,
                IntValue    = 100,
                LongValue   = 10000,
                StringValue = "Test String"
            };
            BasicObject cloned = original.Clone();

            cloned.StringValue = "A different string";

            cloned.ShouldNotBe(original);
        }