FastMoq
Search Results for

    Show / Hide Table of Contents

    Class MockModel<T>

    Generic mock model wrapper (provider-first, Moq legacy compatible).

    Inheritance
    object
    MockModel
    MockModel<T>
    Implements
    IComparable<MockModel>
    IComparable
    IEquatable<MockModel>
    IEqualityComparer<MockModel>
    IComparable<MockModel<T>>
    IEquatable<MockModel<T>>
    IEqualityComparer<MockModel<T>>
    Inherited Members
    MockModel.FastMock
    MockModel.NativeMock
    MockModel.NonPublic
    MockModel.IsEqual<TModel>(TModel, TModel)
    MockModel.ToString()
    MockModel.CompareTo(MockModel)
    MockModel.Equals(MockModel, MockModel)
    MockModel.GetHashCode(MockModel)
    MockModel.Equals(MockModel)
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: FastMoq.Models
    Assembly: FastMoq.Core.dll
    Syntax
    public class MockModel<T> : MockModel, IComparable<MockModel>, IComparable, IEquatable<MockModel>, IEqualityComparer<MockModel>, IComparable<MockModel<T>>, IEquatable<MockModel<T>>, IEqualityComparer<MockModel<T>> where T : class
    Type Parameters
    Name Description
    T

    Properties

    Instance

    Gets the typed mocked instance produced by the active provider.

    Declaration
    public T Instance { get; }
    Property Value
    Type Description
    T

    Type

    Gets the mocked type represented by this model.

    Declaration
    public override Type Type { get; }
    Property Value
    Type Description
    Type
    Overrides
    MockModel.Type

    TypedFastMock

    Gets the provider-agnostic typed fast mock wrapper for T.

    Declaration
    public IFastMock<T> TypedFastMock { get; }
    Property Value
    Type Description
    IFastMock<T>

    Methods

    CompareTo(MockModel<T>?)

    Compares the current typed model with another typed model by using the mocked type full name.

    Declaration
    [ExcludeFromCodeCoverage]
    public int CompareTo(MockModel<T>? other)
    Parameters
    Type Name Description
    MockModel<T> other

    The other model to compare against.

    Returns
    Type Description
    int

    A value indicating the relative sort order of the compared models.

    CompareTo(object?)

    Compares the current model with another object by using the mocked type full name.

    Declaration
    public override int CompareTo(object? obj)
    Parameters
    Type Name Description
    object obj

    The object to compare with the current instance.

    Returns
    Type Description
    int

    A value indicating the relative sort order of the compared objects.

    Overrides
    MockModel.CompareTo(object?)
    Exceptions
    Type Condition
    ArgumentException

    Thrown when obj is not a MockModel<T>.

    Equals(MockModel<T>?)

    Determines whether the current typed model equals another typed model.

    Declaration
    [ExcludeFromCodeCoverage]
    public bool Equals(MockModel<T>? other)
    Parameters
    Type Name Description
    MockModel<T> other

    The other model to compare against.

    Returns
    Type Description
    bool

    true when the models are equal; otherwise, false.

    Equals(MockModel<T>?, MockModel<T>?)

    Determines whether two supplied typed mock models are equal.

    Declaration
    [ExcludeFromCodeCoverage]
    public bool Equals(MockModel<T>? x, MockModel<T>? y)
    Parameters
    Type Name Description
    MockModel<T> x

    The first model to compare.

    MockModel<T> y

    The second model to compare.

    Returns
    Type Description
    bool

    true when the models are equal; otherwise, false.

    Equals(object?)

    Determines whether the current typed mock model represents the same mocked type as another object.

    Declaration
    public override bool Equals(object? obj)
    Parameters
    Type Name Description
    object obj

    The object to compare with the current instance.

    Returns
    Type Description
    bool

    true when obj is a matching MockModel<T>; otherwise, false.

    Overrides
    MockModel.Equals(object?)

    GetHashCode()

    Returns a hash code based on the mocked type represented by this model.

    Declaration
    [ExcludeFromCodeCoverage]
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code for the mocked type.

    Overrides
    MockModel.GetHashCode()

    GetHashCode(MockModel<T>)

    Returns a hash code for the supplied typed mock model.

    Declaration
    [ExcludeFromCodeCoverage]
    public int GetHashCode(MockModel<T> obj)
    Parameters
    Type Name Description
    MockModel<T> obj

    The model whose hash code should be returned.

    Returns
    Type Description
    int

    A hash code for obj.

    Operators

    operator ==(MockModel<T>?, MockModel<T>?)

    Determines whether two typed mock models describe the same mocked type.

    Declaration
    [ExcludeFromCodeCoverage]
    public static bool operator ==(MockModel<T>? a, MockModel<T>? b)
    Parameters
    Type Name Description
    MockModel<T> a

    The first model to compare.

    MockModel<T> b

    The second model to compare.

    Returns
    Type Description
    bool

    true when the models are equal; otherwise, false.

    operator !=(MockModel<T>?, MockModel<T>?)

    Determines whether two typed mock models do not describe the same mocked type.

    Declaration
    [ExcludeFromCodeCoverage]
    public static bool operator !=(MockModel<T>? a, MockModel<T>? b)
    Parameters
    Type Name Description
    MockModel<T> a

    The first model to compare.

    MockModel<T> b

    The second model to compare.

    Returns
    Type Description
    bool

    true when the models are not equal; otherwise, false.

    Implements

    IComparable<T>
    IComparable
    IEquatable<T>
    IEqualityComparer<T>
    IComparable<T>
    IEquatable<T>
    IEqualityComparer<T>

    Extension Methods

    ObjectExtensions.RaiseIfNull<T>(T?, string?, string?, int?, string?)
    TestClassExtensions.GetFieldValue<TObject>(TObject, string, TObject?)
    TestClassExtensions.GetField<TObject>(TObject, string)
    TestClassExtensions.GetMemberName<T, TValue>(T, Expression<Func<T, TValue>>)
    TestClassExtensions.GetMember<T, TValue>(T, Expression<Func<T, TValue>>)
    TestClassExtensions.GetMethodValue<TObject>(TObject, string, object?, params object[])
    TestClassExtensions.GetMethod<TObject>(TObject, string)
    TestClassExtensions.GetPropertyValue<TObject>(TObject, string, object?)
    TestClassExtensions.GetProperty<TObject>(TObject, string)
    TestClassExtensions.SetFieldValue<TObject>(TObject, string, object?)
    TestClassExtensions.SetPropertyValue<TObject>(TObject, string, object?)
    MockerHttpMoqExtensions.SetupHttpMessage(object, Func<HttpResponseMessage>, Expression?, Expression?)
    MockerHttpMoqExtensions.SetupMessageAsync<TMock, TReturn>(object, Expression<Func<TMock, Task<TReturn>>>, Func<TReturn>)
    MockerHttpMoqExtensions.SetupMessageProtectedAsync<TMock, TReturn>(object, string, Func<TReturn>, params object?[]?)
    MockerHttpMoqExtensions.SetupMessageProtected<TMock, TReturn>(object, string, Func<TReturn>, params object?[]?)
    MockerHttpMoqExtensions.SetupMessage<TMock, TReturn>(object, Expression<Func<TMock, TReturn>>, Func<TReturn>)
    TestClassExtensions.GetFieldInfo<TType>(object, string)
    TestClassExtensions.GetFieldValue<T>(object?, FieldInfo)
    TestClassExtensions.GetFieldValue<T, TType>(object, string)
    In this article
    Back to top
    Generated 2026-04-29 03:53 UTC