Пример #1
0
        /// <summary>
        /// Specifies that the configured call/calls should return null when called.
        /// </summary>
        /// <typeparam name="TFake">The type of the fake.</typeparam>
        /// <typeparam name="TMember">The type of the faked member.</typeparam>
        /// <param name="configuration">The configuration to apply to.</param>
        /// <returns>A configuration object.</returns>
        public static IAfterCallSpecifiedConfiguration <TFake> ReturnsNull <TFake, TMember>(this IReturnValueConfiguration <TFake, TMember> configuration) where TMember : class
        {
            Guard.IsNotNull(configuration, "configuration");

            return(configuration.Returns((TMember)null));
        }
Пример #2
0
        /// <summary>
        /// Specifies NumberOfTimes(2) to the IRepeatConfiguration{TFake}.
        /// </summary>
        /// <typeparam name="TFake">The type of fake object.</typeparam>
        /// <param name="configuration">The configuration to set repeat 2 to.</param>
        public static void Twice <TFake>(this IRepeatConfiguration <TFake> configuration)
        {
            Guard.IsNotNull(configuration, "configuration");

            configuration.NumberOfTimes(2);
        }
Пример #3
0
        /// <summary>
        /// Gets all the calls made to the specified fake object.
        /// </summary>
        /// <typeparam name="TFake">The type of the faked object.</typeparam>
        /// <param name="fakedObject">The faked object.</param>
        /// <returns>A collection containing the calls to the object.</returns>
        /// <exception cref="ArgumentException">The object passed in is not a faked object.</exception>
        public static CallCollection <TFake> GetCalls <TFake>(TFake fakedObject) where TFake : class
        {
            Guard.IsNotNull(fakedObject, "fakedObject");

            return(new CallCollection <TFake>(Fake.GetFakeObject(fakedObject)));
        }
        internal CallCollection(FakeObject fake)
        {
            Guard.IsNotNull(fake, "fake");

            this.Fake = fake;
        }
Пример #5
0
        /// <summary>
        /// Gets an object that provides a fluent interface syntax for configuring
        /// the fake object.
        /// </summary>
        /// <typeparam name="TFake">The type of the fake object.</typeparam>
        /// <param name="fakedObject">The fake object to configure.</param>
        /// <returns>A configuration object.</returns>
        /// <exception cref="ArgumentNullException">The fakedObject was null.</exception>
        /// <exception cref="ArgumentException">The object passed in is not a faked object.</exception>
        public static IFakeConfiguration <TFake> Configure <TFake>(TFake fakedObject) where TFake : class
        {
            Guard.IsNotNull(fakedObject, "fakedObject");

            return(new FakeConfiguration <TFake>(Fake.GetFakeObject(fakedObject)));
        }