Exemplo n.º 1
0
 /// <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);
     }));
 }
Exemplo n.º 2
0
 /// <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);
     }));
 }
Exemplo n.º 3
0
 /// <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);
     }));
 }