Beispiel #1
0
 private void MethodThatChangesParamNotByRef(MyTestClass myTestClass)
 {
     myTestClass = new MyTestClass()
     {
         AProperty = "Esto no se debería cambiar"
     };
 }
Beispiel #2
0
        public void When_Modify_Reference_WithoutRef_Then_OuterMethodClassRemains()
        {
            var myClass = new MyTestClass()
            {
                AProperty = "Hello Motto"
            };

            MethodThatChangesParamNotByRef(myClass);
            Assert.AreEqual("Hello Motto", myClass.AProperty);
        }
Beispiel #3
0
        public void When_Modify_Reference_WithtRef_Then_OuterMethodClassChanges()
        {
            var myClass = new MyTestClass()
            {
                AProperty = "Hello Motto"
            };

            MethodThatChangesParamByRef(ref myClass);
            Assert.AreEqual("Esto SI se debería cambiar", myClass.AProperty);
        }