/// <summary> /// Creates a mocked instance from an internal class. /// </summary> /// <param name="fullName">Fully qualified name of the target type.</param> /// <param name="behavior">Specifies behavior of the mock. Default is <see cref="Behavior.RecursiveLoose"/></param> /// <returns>Mock instance</returns> public static object Create(string fullName, Behavior behavior) { return(ProfilerInterceptor.GuardInternal(() => { return MockingContext.CurrentRepository.Create(MockingUtil.GetTypeFrom(fullName), null, behavior, null, null); })); }
/// <summary> /// Creates a mocked instance from an internal class. /// </summary> /// <param name="fullName">Fully qualified name of the target type.</param> /// <param name="behavior">Specifies behavior of the mock. Default is <see cref="Behavior.RecursiveLoose"/></param> /// <returns>Mock instance</returns> public static object Create(string fullName, Behavior behavior) { return(ProfilerInterceptor.GuardInternal(() => { MockCreationSettings settings = MockCreationSettings.GetSettings(behavior); return MockingContext.CurrentRepository.Create(MockingUtil.GetTypeFrom(fullName), settings); })); }
/// <summary> /// Creates a mocked instance from an internal class. /// </summary> /// <param name="fullName">Fully qualified name of the target type.</param> /// <param name="settings">Settings for the mock</param> /// <returns>Mock instance</returns> public static object Create(string fullName, Action <IFluentConfig> settings) { return(ProfilerInterceptor.GuardInternal(() => { var fluentConfig = new FluentConfig(); settings(fluentConfig); return fluentConfig.CreateMock(MockingUtil.GetTypeFrom(fullName), MockingContext.CurrentRepository); })); }