35 lines
2.5 KiB
Markdown
35 lines
2.5 KiB
Markdown
---
|
|
source_files:
|
|
- DataPRO/UnitTest/DTS.Common.Import.Tests/GroupHelperShould.cs
|
|
- DataPRO/UnitTest/DTS.Common.Import.Tests/CalibrationImportShould.cs
|
|
generated_at: "2026-04-17T16:55:20.709240+00:00"
|
|
model: "zai-org/GLM-5-FP8"
|
|
schema_version: 1
|
|
sha256: "58c14f397587ec7e"
|
|
---
|
|
|
|
# Documentation: DTS.Common.Import Tests
|
|
|
|
## 1. Purpose
|
|
|
|
This module contains unit tests for the `GroupHelper` and `CalibrationImport` classes within the `DTS.Common.Import` namespace. The tests verify null-safety handling, group creation behavior, and calibration record manipulation logic. These tests serve as both verification and implicit documentation of the expected behaviors of the production classes under test.
|
|
|
|
---
|
|
|
|
## 2. Public Interface
|
|
|
|
### `GroupHelper` (Static class, inferred from usage)
|
|
|
|
| Method | Signature | Behavior |
|
|
|--------|-----------|----------|
|
|
| `CreateEmptyGroup` | `CreateEmptyGroup()` → Returns an object with `LastModifiedBy` property | Creates a new group instance with `LastModifiedBy` initialized to `"---"`. |
|
|
| `ReverseChannelOrder` | `ReverseChannelOrder(TestTemplate, Dictionary<string, string>, List<SensorData>)` → Returns a collection | Reverses channel order based on a test template, channel mapping dictionary, and sensor list. Returns an empty collection (count 0) when `TestTemplate` is null or sensors list is null. |
|
|
| `NormalizeSensorIds` | `NormalizeSensorIds(List<SensorData>)` → Returns a collection | Normalizes sensor IDs. Returns an empty collection (count 0) when input list is null. |
|
|
|
|
### `CalibrationImport` (Instantiable class)
|
|
|
|
| Method | Signature | Behavior |
|
|
|--------|-----------|----------|
|
|
| `CheckForExcitationCalibration` | `CheckForExcitationCalibration(SensorCalibration, int, ExcitationVoltageOption, string)` → Returns `SensorCalibration` | Checks if a calibration record exists with matching excitation voltage. Returns the same `SensorCalibration` if excitation matches; otherwise adds a new record to `Records.Records` (resulting in count of 2 when starting with 1 non-matching record). |
|
|
| `AddLinearCalRecordIfNeeded` | `AddLinearCalRecordIfNeeded(SensorCalibration, bool, bool)` → Returns `SensorCalibration` | Adds a linear calibration record if the input `Records.Records` count is exactly 1. When count is not 1, returns the same object unchanged. When count is 1, adds a second record with `Poly.IsValid = false`. |
|
|
| `AddLinearZeroMethodIfNeeded` | `AddLinearZeroMethodIfNeeded(SensorCalibration, ZeroMethodType, int, int)` → Returns `SensorCalibration` | Adds zero methods if `Records.Records` count is |