private void EvaluateInjectableProvider(Injectable injectable, IProvider provider) { dependencyMap.RegisterProvider(injectable.Type, injectable.Tag, provider); if (injectable.Attribute is UnityConvenienceAttribute) { dependencyMap.RegisterResolvableDependent(injectable); } else { throw new InjectionException(injectable.Object, "A member cannot be annotated both with [Inject] and [Provides]" + injectable.Type); } }
public void ProviderRegistered() { var provider = MockProviderFactory.Create(providerObject.GetType().GetField("audioSourceProvide"), providerObject, null); var injectable = MockInjectableFactory.Create(providerObject.GetType().GetField("audioSourceInject"), typeof(AudioSource)); map.RegisterProvider(typeof(AudioSource), null, provider); Assert.AreEqual(provider, map.GetProviderForDependency(injectable)); }