示例#1
0
 /// <summary>
 /// Creates a <see cref="Mock{T}"/> with the specified <see cref="MockStyle"/>.
 /// </summary>
 /// <typeparam name="T">The type of mock to create.</typeparam>
 /// <param name="mockStyle"></param>
 /// <returns></returns>
 public Mock <T> CreateMock <T>(MockStyle mockStyle) where T : class
 {
     return(CreateMock <T>(DefinedAs.OfStyle(mockStyle)));
 }
示例#2
0
 /// <summary>
 /// Creates a <see cref="Mock{T}"/> with the specified <see cref="MockStyle"/> and additional types.
 /// </summary>
 /// <typeparam name="T">The type of mock to create.</typeparam>
 /// <param name="mockStyle"></param>
 /// <param name="additionalTypesToMock"></param>
 /// <returns></returns>
 public Mock <T> CreateMock <T>(MockStyle mockStyle, params Type[] additionalTypesToMock) where T : class
 {
     return(CreateMock <T>(DefinedAs.OfStyle(mockStyle).Implementing(additionalTypesToMock)));
 }
示例#3
0
 /// <summary>
 /// Creates a new dynamic mock of the specified type.
 /// </summary>
 /// <typeparam name="TMockedType">The type to mock.</typeparam>
 /// <param name="mockStyle">Specifies how the mock object should behave when first created.</param>
 /// <param name="constructorArgs">The arguments for the constructor of the class to be mocked.
 /// Only applicable when mocking classes with non-default constructors.</param>
 /// <returns>A dynamic mock for the specified type.</returns>
 public TMockedType CreateInstance <TMockedType>(MockStyle mockStyle, params object[] constructorArgs)
 {
     return(CreateInstance <TMockedType>(DefinedAs.OfStyle(mockStyle).WithArgs(constructorArgs)));
 }