public void ShouldOnlyHaveDependenciesInjectionAspectByDefault() { Type t = typeof(AspectTestWithNoAttributes); List<Aspects> r = new AspectUtils(t).WishedAspects(); Assert.IsTrue(r.Count == 1); Assert.That(r[0], Is.EqualTo(Aspects.RESOLVE_DEPENDENCIES)); }
public void ShouldIdenftifyWishedAspects() { Type t = typeof(AspectTest); List<Aspects> r = new AspectUtils(t).WishedAspects(); Assert.IsTrue(r.Contains(Aspects.REQUIRE_TRANSACTION)); Assert.IsTrue(r.Contains(Aspects.RESOLVE_DEPENDENCIES)); Assert.IsFalse(r.Contains(Aspects.LOG)); Assert.IsTrue(r.Count == 2); }
private void InjectDependency(IMethodInvocation input, PropertyInfo property, AutowiredAttribute inject, Type abstractType) { Type concreteType; if (inject.concreteType != null) { concreteType = inject.concreteType; } else { concreteType = ResolveTypes(inject.Url, abstractType); } List<Aspects> aspects = new AspectUtils(concreteType).WishedAspects(); var objInstance = this.context.GetStickedWith(concreteType, this.BehaviorsFromAspects(aspects)); property.SetValue(input.Target, objInstance, null); }