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 instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

    Declaration
    public int CompareTo(MockModel? other)
    Parameters
    Type Name Description
    MockModel other

    An object to compare with this instance.

    Returns
    Type Description
    int

    A value that indicates the relative order of the objects being compared. The return value has these meanings:

    Value Meaning
    Less than zero This instance precedes other in the sort order.
    Zero This instance occurs in the same position in the sort order as other.
    Greater than zero This instance follows other in the sort order.

    CompareTo(object?)

    Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

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

    An object to compare with this instance.

    Returns
    Type Description
    int

    A value that indicates the relative order of the objects being compared. The return value has these meanings:

    Value Meaning
    Less than zero This instance precedes obj in the sort order.
    Zero This instance occurs in the same position in the sort order as obj.
    Greater than zero This instance follows obj in the sort order.
    Exceptions
    Type Condition
    ArgumentException

    obj is not the same type as this instance.

    Equals(MockModel?)

    Indicates whether the current object is equal to another object of the same type.

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

    An object to compare with this object.

    Returns
    Type Description
    bool

    true if the current object is equal to the other parameter; otherwise, false.

    Equals(MockModel?, MockModel?)

    Determines whether the specified objects are equal.

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

    The first object of type T to compare.

    MockModel y

    The second object of type T to compare.

    Returns
    Type Description
    bool

    true if the specified objects are equal; otherwise, false.

    Equals(object?)

    Determines whether the specified object is equal to the current object.

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

    The object to compare with the current object.

    Returns
    Type Description
    bool

    true if the specified object is equal to the current object; otherwise, false.

    Overrides
    object.Equals(object)

    GetHashCode()

    Serves as the default hash function.

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

    A hash code for the current object.

    Overrides
    object.GetHashCode()

    GetHashCode(MockModel)

    Returns a hash code for the specified object.

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

    The object for which a hash code is to be returned.

    Returns
    Type Description
    int

    A hash code for the specified object.

    Exceptions
    Type Condition
    ArgumentNullException

    The type of obj is a reference type and obj is null.

    IsEqual<TModel>(TModel?, TModel?)

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

    ToString()

    Returns a string that represents the current object.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string that represents the current object.

    Overrides
    object.ToString()

    Operators

    operator ==(MockModel?, MockModel?)

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

    operator !=(MockModel?, MockModel?)

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

    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-08 12:38 UTC