public void ShouldResolveDefaultImplementation() { // arrange var target = new Composition.CompositionRoot(); // act var actual = target.Container.Resolve <IController>(); // assert Assert.AreEqual(actual.GetMessage(), "Hello World"); }
public void UseOfDynamicDependencyOverrideAsPartOfStrategy() { // arrange var target = new Composition.CompositionRoot(); // act var actual = target.Container.Resolve <ILayer>(); // assert Assert.IsNotNull(actual); }
public void ShouldResolveAlternativeImplementationWhenUsingOverride() { // arrange var target = new Composition.CompositionRoot(); var resolvedParameter = new ResolvedParameter <IMessageProvider>(nameof(AlternativeMessageProvider)); var dependencyOverride = new DependencyOverride <IMessageProvider>(resolvedParameter); // act var actual = target.Container.Resolve <IController>(dependencyOverride); // assert Assert.AreEqual(actual.GetMessage(), "Goodbye cruel world!"); }
public void DirectUseOfDependencyOverride() { // arrange var target = new Composition.CompositionRoot(); var resolvedParameter = new ResolvedParameter <IDrillBit>(CompositionRoot.SecondDrill); var dependencyOverride = new DependencyOverride <IDrillBit>(resolvedParameter); // act var actual = target.Container.Resolve <ILayer>(dependencyOverride); // assert Assert.IsNotNull(actual); }