-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
591 additions
and
359 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace FastMoq.Models | ||
{ | ||
public interface IHistoryModel | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
namespace FastMoq.Models | ||
{ | ||
/// <summary> | ||
/// Interface IInstanceModel | ||
/// </summary> | ||
public interface IInstanceModel : IHistoryModel | ||
{ | ||
#region Properties | ||
|
||
/// <summary> | ||
/// Gets the type. | ||
/// </summary> | ||
/// <value>The type.</value> | ||
Type Type { get; } | ||
|
||
/// <summary> | ||
/// Gets the create function. | ||
/// </summary> | ||
/// <value>The create function.</value> | ||
Func<Mocker, object>? CreateFunc { get; } | ||
|
||
/// <summary> | ||
/// Gets the type of the instance. | ||
/// </summary> | ||
/// <value>The type of the instance.</value> | ||
Type InstanceType { get; } | ||
|
||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace FastMoq.Models | ||
{ | ||
/// <inheritdoc /> | ||
/// <summary> | ||
/// Class InstanceModel. | ||
/// Implements the <see cref="T:FastMoq.InstanceModel" /> | ||
/// </summary> | ||
/// <typeparam name="TClass">The type of the t class.</typeparam> | ||
/// <seealso cref="T:FastMoq.InstanceModel" /> | ||
[ExcludeFromCodeCoverage] | ||
public class InstanceModel<TClass> : InstanceModel where TClass : class | ||
{ | ||
#region Properties | ||
|
||
/// <inheritdoc /> | ||
public override Type InstanceType => typeof(TClass); | ||
|
||
/// <summary> | ||
/// Gets or sets the create function. | ||
/// </summary> | ||
/// <value>The create function.</value> | ||
public new Func<Mocker, TClass>? CreateFunc | ||
{ | ||
get => (Func<Mocker, TClass>?) base.CreateFunc; | ||
set => base.CreateFunc = value; | ||
} | ||
|
||
#endregion | ||
|
||
/// <inheritdoc /> | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="T:FastMoq.InstanceModel`1" /> class. | ||
/// </summary> | ||
public InstanceModel() : this(default(Func<Mocker, TClass>)) { } | ||
|
||
/// <inheritdoc /> | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="T:FastMoq.InstanceModel`1" /> class. | ||
/// </summary> | ||
/// <param name="createFunc">The create function.</param> | ||
public InstanceModel(Func<Mocker, TClass>? createFunc) : base(typeof(TClass), typeof(TClass), createFunc) { } | ||
|
||
/// <inheritdoc /> | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="InstanceModel{TClass}" /> class. | ||
/// </summary> | ||
/// <param name="createFunc">The create function.</param> | ||
/// <param name="arguments">The arguments.</param> | ||
public InstanceModel(Func<Mocker, TClass>? createFunc, List<object?> arguments) : this(createFunc) => | ||
Arguments = arguments; | ||
|
||
/// <inheritdoc /> | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="T:FastMoq.Models.InstanceModel{T}" /> class. | ||
/// </summary> | ||
/// <param name="model">The model.</param> | ||
public InstanceModel(InstanceModel model) : this(model.CreateFunc as Func<Mocker, TClass>, model.Arguments) { } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters