public void OverrideClassMethods() { BaseType1 bt1 = CreateMixedObject <BaseType1> (typeof(BT1Mixin1)); Assert.That(bt1.VirtualMethod(), Is.EqualTo("BT1Mixin1.VirtualMethod")); Assert.IsNotNull(bt1.GetType().GetMethod("VirtualMethod", Type.EmptyTypes), "overridden member is public and has the same name"); Assert.That(bt1.GetType().GetMethod("VirtualMethod", Type.EmptyTypes).GetBaseDefinition().DeclaringType, Is.EqualTo(typeof(BaseType1))); }
public void MixinWithProtectedOverrider() { BaseType1 obj = CreateMixedObject <BaseType1> (typeof(MixinWithProtectedOverrider)); Assert.That(obj.VirtualMethod(), Is.EqualTo("MixinWithProtectedOverrider.VirtualMethod-BaseType1.VirtualMethod")); Assert.That(obj.VirtualProperty, Is.EqualTo("MixinWithProtectedOverrider.VirtualProperty-BaseType1.BackingField")); Assert.That(obj.GetVirtualEventInvocationList(), Is.EqualTo(null)); obj.VirtualEvent += delegate { }; Assert.That(obj.GetVirtualEventInvocationList().Length, Is.EqualTo(2)); }
public void ValueTypeMixin() { BaseType1 bt1 = CreateMixedObject <BaseType1>(typeof(ValueTypeMixin)); Assert.That(bt1.VirtualMethod(), Is.EqualTo("ValueTypeMixin.VirtualMethod")); }