Class InMemoryCdcChange
Represents a simulated CDC change record for testing scenarios.
public sealed class InMemoryCdcChange
- Inheritance
-
InMemoryCdcChange
- Inherited Members
Remarks
Use this class to simulate database changes in unit and integration tests without requiring a real database connection.
Properties
ChangeType
Gets or sets the type of change.
public CdcChangeType ChangeType { get; init; }
Property Value
- CdcChangeType
The change type (Insert, Update, or Delete).
Changes
Gets or sets the column changes in this CDC record.
public IReadOnlyList<CdcDataChange> Changes { get; init; }
Property Value
- IReadOnlyList<CdcDataChange>
The collection of column changes.
Metadata
Gets or sets optional metadata associated with the change.
public IReadOnlyDictionary<string, object?>? Metadata { get; init; }
Property Value
- IReadOnlyDictionary<string, object>
The metadata dictionary.
TableName
Gets or sets the table name where the change occurred.
public string TableName { get; init; }
Property Value
- string
The fully qualified table name (e.g., "dbo.Orders").
Timestamp
Gets or sets the timestamp when the change occurred.
public DateTimeOffset Timestamp { get; init; }
Property Value
- DateTimeOffset
The change timestamp. Default is current UTC time.
Methods
Delete(string, params CdcDataChange[])
Creates a new DELETE change record.
public static InMemoryCdcChange Delete(string tableName, params CdcDataChange[] changes)
Parameters
tableNamestringThe table name.
changesCdcDataChange[]The column values being deleted.
Returns
- InMemoryCdcChange
A new InMemoryCdcChange representing a delete.
Insert(string, params CdcDataChange[])
Creates a new INSERT change record.
public static InMemoryCdcChange Insert(string tableName, params CdcDataChange[] changes)
Parameters
tableNamestringThe table name.
changesCdcDataChange[]The column values being inserted.
Returns
- InMemoryCdcChange
A new InMemoryCdcChange representing an insert.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Update(string, params CdcDataChange[])
Creates a new UPDATE change record.
public static InMemoryCdcChange Update(string tableName, params CdcDataChange[] changes)
Parameters
tableNamestringThe table name.
changesCdcDataChange[]The column changes (old and new values).
Returns
- InMemoryCdcChange
A new InMemoryCdcChange representing an update.