FastMoq
Search Results for

    Show / Hide Table of Contents

    Class MockModel

    Contains provider-agnostic mock and Type information.

    Inheritance
    object
    MockModel
    MockModel<T>
    Implements
    IComparable<MockModel>
    IComparable
    IEquatable<MockModel>
    IEqualityComparer<MockModel>
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: FastMoq.Models
    Assembly: FastMoq.Core.dll
    Syntax
    public class MockModel : IComparable<MockModel>, IComparable, IEquatable<MockModel>, IEqualityComparer<MockModel>

    Properties

    FastMock

    Provider-agnostic abstraction for the mock instance.

    Declaration
    public IFastMock FastMock { get; }
    Property Value
    Type Description
    IFastMock

    Instance

    The mocked instance (object under test substitute) from the provider abstraction.

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

    NativeMock

    Native provider object used to arrange or inspect behavior with the active mocking library. For Moq this is a FastMoq.Models.MockModel.Mock; for providers like NSubstitute or Reflection this is typically the provider-native instance.

    Declaration
    public object NativeMock { get; }
    Property Value
    Type Description
    object

    NonPublic

    Indicates whether the mock was created allowing non-public constructors.

    Declaration
    public bool NonPublic { get; set; }
    Property Value
    Type Description
    bool

    Type

    Mocked type exposed by the current IFastMock instance.

    Declaration
    public virtual Type Type { get; }
    Property Value
    Type Description
    Type

    Methods

    CompareTo(MockModel?)

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

    Declaration
    public int CompareTo(MockModel? other)
    Parameters
    Type Name Description
    MockModel 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 virtual 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.

    Exceptions
    Type Condition
    ArgumentException

    Thrown when obj is not a MockModel.

    Equals(MockModel?)

    Determines whether the current model equals another model.

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

    The other model to compare against.

    Returns
    Type Description
    bool

    true when the models are equal; otherwise, false.

    Equals(MockModel?, MockModel?)

    Determines whether two supplied mock models are equal.

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

    The first model to compare.

    MockModel y

    The second model to compare.

    Returns
    Type Description
    bool

    true when the models are equal; otherwise, false.

    Equals(object?)

    Determines whether the current 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 MockModel for the same mocked type; otherwise, false.

    Overrides
    object.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
    object.GetHashCode()

    GetHashCode(MockModel)

    Returns a hash code for the supplied mock model.

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

    The model whose hash code should be returned.

    Returns
    Type Description
    int

    A hash code for obj.

    IsEqual<TModel>(TModel?, TModel?)

    Determines whether two mock models should be considered equal based on their mocked type names.

    Declaration
    public static bool IsEqual<TModel>(TModel? x, TModel? y) where TModel : MockModel
    Parameters
    Type Name Description
    TModel x

    The first model to compare.

    TModel y

    The second model to compare.

    Returns
    Type Description
    bool

    true when both models describe the same mocked type; otherwise, false.

    Type Parameters
    Name Description
    TModel

    The concrete mock model type being compared.

    ToString()

    Returns the mocked type name for display purposes.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    The simple name of the mocked type.

    Overrides
    object.ToString()

    Operators

    operator ==(MockModel?, MockModel?)

    Determines whether two mock models describe the same mocked type.

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

    The first model to compare.

    MockModel b

    The second model to compare.

    Returns
    Type Description
    bool

    true when the models are equal; otherwise, false.

    operator !=(MockModel?, MockModel?)

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

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

    The first model to compare.

    MockModel 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>

    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