public void FindAllActions() { ActionsResolver.Current = new ActionsResolver( () => PluginManager.Current.ResolveActions()); Resolution.Freeze(); var actions = ActionsResolver.Current.Actions; Assert.AreEqual(2, actions.Count()); // order is unspecified, but both must be there bool hasAction1 = actions.ElementAt(0) is SingletonAction || actions.ElementAt(1) is SingletonAction; bool hasAction2 = actions.ElementAt(0) is NonSingletonAction || actions.ElementAt(1) is NonSingletonAction; Assert.IsTrue(hasAction1); Assert.IsTrue(hasAction2); SingletonAction action = (SingletonAction)(actions.ElementAt(0) is SingletonAction ? actions.ElementAt(0) : actions.ElementAt(1)); // ensure we respect the singleton Assert.AreSame(SingletonAction.Instance, action); }
internal SingletonSubscriptionArgs(T previousValue, T actualValue, SingletonAction action) { PreviousValue = previousValue; ActualValue = actualValue; Action = action; }
public void Invoke <T>(T previousValue, T actualValue, SingletonAction action) { ((Delegate)Action).DynamicInvoke(new SingletonSubscriptionArgs <T>(previousValue, actualValue, action)); }