Example #1
0
        /// <summary>
        /// Method allowing to retrieve the <see cref="IFeatureFixtureRunner"/> instance allowing to define and execute scenarios.
        /// This method is dedicated for projects extending LightBDD with user friendly API for running scenarios - it should not be used directly by regular LightBDD users.
        /// </summary>
        /// <typeparam name="TContext">Bdd runner context type.</typeparam>
        /// <param name="runner">Bdd runner.</param>
        /// <returns>Instance of <see cref="IFeatureFixtureRunner"/>.</returns>
        /// <exception cref="NotSupportedException">Thrown if <paramref name="runner"/> does not implement <see cref="IFeatureFixtureRunner"/>.</exception>
        public static IFeatureFixtureRunner Integrate <TContext>(this IBddRunner <TContext> runner)
        {
            if (runner == null)
            {
                throw new ArgumentNullException(nameof(runner));
            }

            if (!(runner is IFeatureFixtureRunner))
            {
                throw new NotSupportedException($"The type '{runner.GetType().Name}' has to implement '{nameof(IFeatureFixtureRunner)}' interface to support integration.");
            }

            return((IFeatureFixtureRunner)runner);
        }