public void Get_ReturnsSameInstance_WhenHasInstanceProvidesMultipleTypes() { ClassA instance = new ClassA(); definition.HasInstance(instance).Provides<Object>().Provides<ClassA>(); Assert.AreSame(definition.Get<Object>(), definition.Get<ClassA>()); }
public void Decorator_GetsInstanceOfParentForServiceItProvides() { DecoratorA instance = null; IA parent = new ClassA(); definition.HasInstance(parent).Provides<IA>(); definition.HasSubsystem(new DelegateExecutingBuilder( delegate(ISystemDefinition scope) { scope.HasSingleton<DecoratorA>().Provides<IA>().Provides<DecoratorA>(); instance = scope.Get<DecoratorA>(); })); Assert.AreEqual(parent, instance.Parent); }