Beispiel #1
0
        public void PassStructByReference_ChangeValues_OriginalChanged()
        {
            Dog d = new Dog {
                Name = "Baxter", Age = 99
            };

            ValueChanger.ChangeStructRef(ref _Dog);
            Assert.AreEqual(42, _Dog.Age);
            Assert.AreEqual("Benji", _Dog.Name);
        }
Beispiel #2
0
 public void PassClass_CreateNewObject_OriginalChanged()
 {
     ValueChanger.ChangeClassRef(ref _Cat);
     Assert.AreEqual(7, _Cat.Age);
     Assert.AreEqual("Whiskers", _Cat.Name);
 }
Beispiel #3
0
 public void PassClass_ChangeValues_OriginalChanged()
 {
     ValueChanger.ChangeClass(_Cat);
     Assert.AreEqual(12, _Cat.Age);
     Assert.AreEqual("Garfield", _Cat.Name);
 }
Beispiel #4
0
 public void PassStructByValue_ChangeValues_OriginalUnchanged()
 {
     ValueChanger.ChangeStructValue(_Dog);
     Assert.AreEqual(5, _Dog.Age);
     Assert.AreEqual("Rusty", _Dog.Name);
 }