public void RaiseReferenceInitializatingEvent_InvokesMixinHook() { var domainObject = _transaction.ExecuteInScope(() => HookedTargetClass.NewObject()); // indirect call of RaiseReferenceInitializatingEvent var mixinInstance = Mixin.Get <HookedDomainObjectMixin> (domainObject); Assert.That(mixinInstance.OnDomainObjectReferenceInitializingCalled, Is.True); }
public void RaiseReferenceInitializatingEvent_InvokesMixinHook_WhilePropertyAccessForbidden() { var mixinInstance = new HookedDomainObjectMixin(); mixinInstance.InitializationHandler += (sender, args) => Dev.Null = ((HookedDomainObjectMixin)sender).Target.Property; using (new MixedObjectInstantiationScope(mixinInstance)) { _transaction.ExecuteInScope(() => HookedTargetClass.NewObject()); // indirect call of RaiseReferenceInitializatingEvent } }