[Test] public void GetNonVirtualPropertySetter_WhenPropertyVirtual_ReturnDelegateCallsSubProperty()
        {
            var sub    = new PropertySub <T>();
            var setter = sub.GetNonVirtualPropertySetter <T>(typeof(PropertyBase <T>), "VirtualPropertyT");

            AssertVirtualSetterT(sub, setter);
        }
        [Test] public void GetNonVirtualPropertyGetterOrNull_WhenPropertyVirtual_ReturnsDelegateCallsSubProperty()
        {
            var sub    = new PropertySub <T>();
            var getter = sub.GetNonVirtualPropertyGetterOrNull <T>(typeof(PropertyBase <T>), "VirtualPropertyT");

            AssertVirtualGetterT(sub, getter);
        }
Beispiel #3
0
        [Test] public void GetInstancePropertySetter_WhenPropertyVirtual_ReturnDelegateCallsSubProperty()
        {
            var sub    = new PropertySub <T>();
            var setter = sub.GetInstancePropertySetter <T>("VirtualPropertyT");

            AssertVirtualSetterT(sub, setter);
        }
Beispiel #4
0
        [Test] public void GetInstancePropertyGetterOrNull_WhenPropertyVirtual_ReturnsDelegateCallsSubProperty()
        {
            var sub    = new PropertySub <T>();
            var getter = sub.GetInstancePropertyGetterOrNull <T>("VirtualPropertyT");

            AssertVirtualGetterT(sub, getter);
        }
        [Test] public void GetNonVirtualPropertyAccessor_WhenPropertyVirtual_ReturnsAccessorCallsSubProperty()
        {
            var sub      = new PropertySub <T>();
            var accessor = sub.GetNonVirtualPropertyAccessor <T>(typeof(PropertyBase <T>), "VirtualPropertyT");

            AssertVirtualGetterT(sub, accessor.Get);
            AssertVirtualSetterT(sub, accessor.Set);
        }
Beispiel #6
0
        [Test] public void GetInstancePropertyAccessor_WhenPropertyVirtual_ReturnsAccessorCallsSubProperty()
        {
            var sub      = new PropertySub <T>();
            var accessor = sub.GetInstancePropertyAccessor <T>("VirtualPropertyT");

            AssertVirtualGetterT(sub, accessor.Get);
            AssertVirtualSetterT(sub, accessor.Set);
        }
 private void AssertVirtualSetterT(PropertySub <T> sub, Action <T> setter)
 {
     _base = sub;
     sub.InstancePropertyT   = _one;
     _base.InstancePropertyT = _one;
     setter(_two);
     Assert.That(sub.InstancePropertyT, Is.EqualTo(_one));
     Assert.That(_base.InstancePropertyT, Is.EqualTo(_two));
 }
 private void AssertVirtualGetterT(PropertySub <T> sub, Func <T> getter)
 {
     _base = sub;
     _base.InstancePropertyT = _one;
     sub.InstancePropertyT   = _two;
     Assert.That(getter(), Is.EqualTo(_one));
     _base.InstancePropertyT = _two;
     sub.InstancePropertyT   = _one;
     Assert.That(getter(), Is.EqualTo(_two));
 }
        private void AssertVirtualSetterT(Action <PropertyBase <T>, T> setter)
        {
            var sub = new PropertySub <T>();

            _base = sub;
            sub.InstancePropertyT   = _one;
            _base.InstancePropertyT = _one;
            setter(_base, _two);
            Assert.That(sub.InstancePropertyT, Is.EqualTo(_two));
            Assert.That(_base.InstancePropertyT, Is.EqualTo(_one));
        }
        private void AssertVirtualGetterT(Func <PropertyBase <T>, T> getter)
        {
            var sub = new PropertySub <T>();

            _base = sub;
            _base.InstancePropertyT = _one;
            sub.InstancePropertyT   = _two;
            Assert.That(getter(_base), Is.EqualTo(_two));
            _base.InstancePropertyT = _two;
            sub.InstancePropertyT   = _one;
            Assert.That(getter(_base), Is.EqualTo(_one));
        }