Example #1
0
        public void Copy_NullExpression_Succeeds()
        {
            //Arrange
            ComplexStruct complexStructStub = ComplexStructFactory();

            //Act
            ComplexStruct copy = complexStructStub.Copy(null);

            //Assert
            Assert.IsTrue(complexStructStub.DeepEquals(copy));
        }
Example #2
0
        public void Copy_UnaryExpressions_AreIgnoredAndValueIsSet()
        {
            //Arrange
            ComplexStruct complexStructStub = ComplexStructFactory();

            //Act
            ComplexStruct copy = complexStructStub.Copy(cs => (short)(((ComplexStruct)(object)cs).SimpleStruct.Int), MAGIC_INT);

            //Assert
            Assert.IsFalse(complexStructStub.DeepEquals(copy));
            Assert.AreNotEqual(complexStructStub.SimpleStruct.Int, copy.SimpleStruct.Int);
            Assert.AreEqual(MAGIC_INT, copy.SimpleStruct.Int);
        }
Example #3
0
        public void Copy_DeepExpression_SetsValue()
        {
            //Arrange
            ComplexStruct complexStructStub = ComplexStructFactory();

            //Act
            ComplexStruct copy = complexStructStub.Copy(cs => cs.SimpleStruct.Int, MAGIC_INT);

            //Assert
            Assert.IsFalse(complexStructStub.DeepEquals(copy));
            Assert.AreNotEqual(complexStructStub.SimpleStruct.Int, copy.SimpleStruct.Int);
            Assert.AreEqual(MAGIC_INT, copy.SimpleStruct.Int);
        }
Example #4
0
        public void Copy_ShallowExpression_SetsValue()
        {
            //Arrange
            ComplexStruct complexStructStub = ComplexStructFactory();

            //Act
            ComplexStruct copy = complexStructStub.Copy(cs => cs.Str, MAGIC_STRING);

            //Assert
            Assert.IsFalse(complexStructStub.DeepEquals(copy));
            Assert.AreNotEqual(complexStructStub.Str, copy.Str);
            Assert.AreEqual(MAGIC_STRING, copy.Str);
        }