Class MockModel
Contains provider-agnostic mock and Type information.
Inherited Members
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 |
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 |
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 |
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 |
Overrides
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
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 |
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
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 |
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 |