private void RegisterDelegatingFactoryWithContext(bool buildSingletonObjectsWhenInvoked)
        {
            var targetBuilder = new ThingThatBuildsTargets();
            var factory = new DelegateInvokingFactoryObject<TargetToBuild>(targetBuilder.BuildTarget, buildSingletonObjectsWhenInvoked);

            Assume.That(ContextRegistry.GetContext(), Is.InstanceOf<IConfigurableApplicationContext>(), "test requires a registered context that implements IConfigurableApplicationContext!");

            var ctx = (IConfigurableApplicationContext)ContextRegistry.GetContext();
            ctx.ObjectFactory.RegisterSingleton("target", factory);
        }
        private void RegisterDelegatingFactoryWithContext(bool buildSingletonObjectsWhenInvoked)
        {
            var targetBuilder = new ThingThatBuildsTargets();
            var factory       = new DelegateInvokingFactoryObject <TargetToBuild>(targetBuilder.BuildTarget, buildSingletonObjectsWhenInvoked);

            Assume.That(ContextRegistry.GetContext(), Is.InstanceOf <IConfigurableApplicationContext>(), "test requires a registered context that implements IConfigurableApplicationContext!");

            var ctx = (IConfigurableApplicationContext)ContextRegistry.GetContext();

            ctx.ObjectFactory.RegisterSingleton("target", factory);
        }