/// <summary> /// Set an existing plugin's dependency to an existing service. /// </summary> /// <param name="plugin">Plugin</param> /// <param name="service">Service the plugin depends on</param> /// <param name="runningRequirement">How the plugin depends on the service</param> internal void SetPluginDependency(PluginInfo plugin, ServiceInfo service, DependencyRequirement runningRequirement) { Debug.Assert(plugin != null); Debug.Assert(service != null); Debug.Assert(ServiceInfos.Contains(service)); Debug.Assert(PluginInfos.Contains(plugin)); MockServiceReferenceInfo reference = new MockServiceReferenceInfo(plugin, service, runningRequirement); plugin.InternalServiceReferences.Add(reference); }
/// <summary> /// Removes an existing plugin dependency. /// </summary> /// <param name="plugin">Plugin owner.</param> /// <param name="service">Service reference</param> internal void RemovePluginDependency(PluginInfo plugin, ServiceInfo service) { Debug.Assert(plugin != null); Debug.Assert(service != null); Debug.Assert(ServiceInfos.Contains(service)); Debug.Assert(PluginInfos.Contains(plugin)); MockServiceReferenceInfo reference = plugin.InternalServiceReferences.First(x => x.Reference == service); if (reference != null) { plugin.InternalServiceReferences.Remove(reference); } }