Пример #1
0
 private void MethodThatChangesParamNotByRef(MyTestClass myTestClass)
 {
     myTestClass = new MyTestClass()
     {
         AProperty = "Esto no se debería cambiar"
     };
 }
Пример #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);
        }
Пример #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);
        }