/// <summary> /// Configures a mock of the specified type to setup a call matching the specified expression to return a result of the specified type. /// </summary> /// <typeparam name="TService">The type of the service.</typeparam> /// <typeparam name="TResult">The type of the result.</typeparam> /// <param name="fixture">The fixture.</param> /// <param name="expression">The expression.</param> /// <param name="result">The result.</param> /// <param name="composer">The composer.</param> /// <param name="parameters">The parameters.</param> /// <returns></returns> public static ITestFixture HavingMockedComposed <TService, TResult>( this ITestFixture fixture, Expression <Func <TService, TResult> > expression, out TResult result, Func <IPostprocessComposer <TResult>, IPostprocessComposer <TResult> > composer, params Parameter[] parameters) where TService : class => fixture.HavingComposedModel(out result, composer) .HavingMocked(expression, result, parameters);
/// <summary> /// Configures a mock of the specified type to setup a call matching the /// specified expression to throw an exception of the specified type. /// </summary> /// <typeparam name="TService">The type of the service.</typeparam> /// <typeparam name="TException">The type of the exception.</typeparam> /// <param name="fixture">The fixture.</param> /// <param name="expression">The expression.</param> /// <param name="exception">The exception.</param> /// <param name="composer">The composer.</param> /// <param name="parameters">The parameters.</param> /// <returns></returns> public static ITestFixture HavingMockThrow <TService, TException>( this ITestFixture fixture, Expression <Action <TService> > expression, out TException exception, Func <IPostprocessComposer <TException>, IPostprocessComposer <TException> > composer = null, params Parameter[] parameters) where TService : class where TException : Exception => fixture.HavingComposedModel(out exception, composer) .HavingMockThrow(expression, exception, parameters);