Files
2026-04-17 14:55:32 -04:00

4.7 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
DataPRO/UnitTest/DatabaseUnitTesting/Utilities/Results/Row.cs
DataPRO/UnitTest/DatabaseUnitTesting/Utilities/Results/Column.cs
DataPRO/UnitTest/DatabaseUnitTesting/Utilities/Results/Database.cs
DataPRO/UnitTest/DatabaseUnitTesting/Utilities/Results/Table.cs
DataPRO/UnitTest/DatabaseUnitTesting/Utilities/Results/ResultSetParser.cs
DataPRO/UnitTest/DatabaseUnitTesting/Utilities/Results/XmlFileAdapter.cs
2026-04-17T15:50:55.325776+00:00 zai-org/GLM-5-FP8 1 f6d60a0ae7a270c5

Database Unit Testing Results Module Documentation

1. Purpose

This module provides an in-memory representation of database result sets for unit testing purposes. It enables parsing SQL query results into a structured object model (Database, Table, Row, Column), serializing and deserializing this model to/from XML files, and comparing database states for equality. The module serves as the core data model and I/O layer for database unit testing comparisons, allowing test results to be persisted and compared against expected outcomes.


2. Public Interface

All types in this module are internal to the DatabaseUnitTesting.Utilities.Results namespace.

Row (class)

Member Signature Description
Constructor Row(string type) Creates a new row with the specified type (converted to lowercase).
AddColumn void AddColumn(Column column) Adds a column to the row. Invalidates the cached KeyString.
KeyString string KeyString { get; } Lazily computed and cached string key for comparison. Format: _type + DELIMITER + each column's SortString.
ColumnCount int ColumnCount { get; } Returns the number of columns in the row.
DELIMITER const string DELIMITER = "\x1e;;" Delimiter used when constructing KeyString.

Column (class)

Member Signature Description
Constructor Column(string name, object value) Creates a column with the given name and value. Value is converted via Convert(). SortString is constructed as name.ToLower() + DELIMITER + _value.
Convert static string Convert(object value) Converts object to string. Special handling for byte[] (hex format "0x...") and DateTime (custom format with trimmed trailing zeros/colons). Other types use ToString().
Name string Name { get; } Returns the column name.
Value string Value { get; } Returns the converted string value.
SortString string SortString { get; } Returns the pre-computed sort/comparison string.
DELIMITER const string DELIMITER = "\x1f;;" Delimiter used in SortString.

Database (class)

Member Signature Description
AddTable void AddTable(Table table) Adds a table to the database. If the table already exists (by equality), increments its count. Updates _tableCount and _hashCode.
ContainsTable bool ContainsTable(Table table) Returns true if the database contains a table equal to the given one.
GetCount int GetCount(Table table) Returns the count of how many times the given table was added.
TableCount int TableCount { get; } Total number of tables added (including duplicates).
Tables IEnumerable<KeyValuePair<Table, int>> Tables { get; } Returns the internal dictionary of unique tables with their counts.
GetHashCode override int GetHashCode() Returns the cumulative hash code of all added tables.
Equals override bool Equals(object otherObject) Compares databases by TableCount, GetHashCode(), and verifies each table exists with the same count in the other database.

Table (class)

Member Signature Description
Constructor Table(string name1) Creates a table with name1 and empty name2.
Constructor Table(string name1, string name2) Creates a table with both names (converted to lowercase).
AddRow void AddRow(Row row) Adds a row to the table. If a row with the same KeyString exists, increments its count. Updates _rowCount and _hashCode.
AddField void AddField(string name, string type) Adds a column to the schema row. Increments _fieldCount. Note: hash code update is commented out.
LookupRow bool LookupRow(string key, out int other) Looks up a row by its key string, returning the count via out parameter.
Schema Row Schema { get; set; } Gets or sets the schema row. Setting updates _fieldCount.
Name1 string Name1 { get; } Returns the first name.
Name2 `string