public void ExtensionCanAddStrategy() { SpyStrategy spy = new SpyStrategy(); SpyExtension extension = new SpyExtension(spy, UnityBuildStage.PostInitialization); IUnityContainer container = new UnityContainer() .AddExtension(extension); object result = container.Resolve <object>(); Assert.True(spy.BuildUpWasCalled); Assert.Same(result, spy.Existing); }
public void ExtensionCanAddPolicy() { SpyStrategy spy = new SpyStrategy(); SpyPolicy spyPolicy = new SpyPolicy(); SpyExtension extension = new SpyExtension(spy, UnityBuildStage.PostInitialization, spyPolicy, typeof(SpyPolicy)); IUnityContainer container = new UnityContainer() .AddExtension(extension); container.Resolve <object>(); Assert.True(spyPolicy.WasSpiedOn); }