public void Twice_should_throw_when_configuration_is_null()
        {
            // Arrange
            IBehaviorLifetimeConfiguration <IVoidConfiguration> behaviorLifetimeConfiguration = null;

            // Act
            var exception = Record.Exception(() => behaviorLifetimeConfiguration.Twice());

            // Assert
            exception.Should().BeOfType <ArgumentNullException>();
        }
Beispiel #2
0
        /// <summary>
        /// Specifies that a call's configured behavior should apply only for 2 calls.
        /// </summary>
        /// <typeparam name="TInterface">The type of configuration interface to return.</typeparam>
        /// <param name="configuration">The configuration on which to set the behavior lifetime to 2.</param>
        /// <returns>A configuration object that lets you define the subsequent behavior.</returns>
        public static IThenConfiguration <TInterface> Twice <TInterface>(this IBehaviorLifetimeConfiguration <TInterface> configuration)
        {
            Guard.AgainstNull(configuration, nameof(configuration));

            return(configuration.NumberOfTimes(2));
        }