Class MockModel<T>
Generic mock model wrapper (provider-first, Moq legacy compatible).
Inherited Members
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
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
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when |
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 |
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 |
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 |
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<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 |
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 |
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 |