Пример #1
0
        public void ConfigureChronoscopeWithBuilderOnlyRefusesNullBuilder()
        {
            // arrange
            IChronoscopeBuilder builder = null;

            // act
            var ex = Assert.Throws <ArgumentNullException>(() => builder.ConfigureChronoscope(b => { }));

            // assert
            Assert.Equal(nameof(builder), ex.ParamName);
        }
        /// <summary>
        /// Allows adding chronoscope specific extensions for configuration.
        /// </summary>
        /// <param name="builder">The builder to extend.</param>
        /// <param name="configure">The callback to use for adding services.</param>
        /// <returns>The same builder instance to allow chaining.</returns>
        public static IChronoscopeBuilder ConfigureChronoscope(this IChronoscopeBuilder builder, Action <IChronoscopeBuilder> configure)
        {
            if (builder is null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (configure is null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            return(builder.ConfigureChronoscope((context, services) => configure(services)));
        }