Exemple #1
0
        /// <summary>
        /// Factory method which creates a new implementation of <see cref="IScreenplayIntegration"/>
        /// from a given configuration type.
        /// </summary>
        /// <param name="configType">The <c>System.Type</c> of the implementation of <see cref="IIntegrationConfig"/> to use.</param>
        /// <param name="rootContainer">An optional mechanism by which to pass the root FlexDi container to the integration.</param>
        public IScreenplayIntegration Create(Type configType, FlexDi.IContainer rootContainer = null)
        {
            var config  = GetConfig(configType);
            var builder = GetBuilder(config);

            return(new ScreenplayIntegration(builder, rootContainer));
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:CSF.Screenplay.ScreenplayScenario"/> class.
        /// </summary>
        /// <param name="featureId">Feature identifier.</param>
        /// <param name="scenarioId">Scenario identifier.</param>
        /// <param name="container">A MicroDi container instance.</param>
        public Scenario(IdAndName featureId,
                        IdAndName scenarioId,
                        FlexDi.IContainer container)
        {
            if (container == null)
            {
                throw new ArgumentNullException(nameof(container));
            }
            if (featureId == null)
            {
                throw new ArgumentNullException(nameof(featureId));
            }
            if (scenarioId == null)
            {
                throw new ArgumentNullException(nameof(scenarioId));
            }

            identity = Guid.NewGuid();

            FeatureId      = featureId;
            ScenarioId     = scenarioId;
            this.container = container;

            this.container.AddRegistrations(h => {
                h.RegisterInstance(this).As <IScenarioName>();
            });
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:CSF.Screenplay.SpecFlow.ScreenplayDependencyInjectionBuilder"/> class.
        /// </summary>
        /// <param name="specflowContainer">Specflow container.</param>
        /// <param name="screenplayContainer">Screenplay container.</param>
        public ScreenplayDependencyInjectionBuilder(IObjectContainer specflowContainer,
                                                    FlexDi.IContainer screenplayContainer)
        {
            if (screenplayContainer == null)
            {
                throw new ArgumentNullException(nameof(screenplayContainer));
            }
            if (specflowContainer == null)
            {
                throw new ArgumentNullException(nameof(specflowContainer));
            }

            this.screenplayContainer = screenplayContainer;
            this.specflowContainer   = specflowContainer;
        }
Exemple #4
0
        public BoDiContainerProxy(FlexDi.IContainer proxiedContainer)
        {
            if (proxiedContainer == null)
            {
                throw new ArgumentNullException(nameof(proxiedContainer));
            }
            this.proxiedContainer = proxiedContainer;

            proxiedContainer.AddRegistrations(r => r.RegisterInstance(this).As <IObjectContainer>());

            proxiedContainer.ServiceResolved += (sender, e) => {
                if (e.Registration is TypeRegistration)
                {
                    InvokeObjectCreated(e.Instance);
                }
            };
        }
Exemple #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:CSF.Screenplay.SpecFlow.ScreenplayBinding"/> class.
 /// </summary>
 /// <param name="container">Container.</param>
 public ScreenplayBinding(FlexDi.IContainer container)
 {
     this.container = container;
 }