2.7 KiB
2.7 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||||
|---|---|---|---|---|---|---|---|---|---|
|
2026-04-16T14:12:11.899792+00:00 | zai-org/GLM-5-FP8 | 1 | 6d6fac19105f4e74 |
DTS.Common.Tests
Purpose
This module contains the unit test suite for the DTS.Common library, which provides core utilities and domain logic for sensor management, signal processing, and network configuration. Specifically, it validates the behavior of sensor channel type parsing, linearization formulas for engineering unit conversion, ISO-compliant filter class resolution, and network connection string parsing.
Public Interface
The following classes and methods are tested by this module. The actual implementations reside in DTS.Common.Classes.Sensors, DTS.Common.Utils, and DTS.Common.Classes.Groups.
DTS.Common.Classes.Sensors.ChannelTypeUtility
string ParseSensorKnownChannelType(string sensorName)- Extracts a known channel type identifier from the beginning of a sensor name string.
- Returns
string.Emptyif the input is null, empty, has fewer than 2 characters, or starts with an unknown 2-character prefix. - Returns the string representation of a
KnownChannelTypesenum value if the prefix is valid.
DTS.Common.Utils.NetworkUtils
bool TryParseConnectionString(string connectionString, out string ipAddress)- Attempts to extract an IP address from a connection string.
- Returns
trueand populatesipAddress(stripped of port and protocol) if a valid IP is found. - Returns
falsefor null inputs, empty strings, or non-IP connection strings (e.g., USB device paths). - Supports formats:
IP,IP:Port,protocol://IP:Port(e.g.,http,udp).
DTS.Common.Classes.Sensors.LinearizationFormula
double GetLinearizedValue(double input, int decimalPlaces, bool? proportional)- Calculates the engineering unit value from a raw input using polynomial coefficients defined in
PolynomialCoefficients. - Behavior changes based on the
proportionalflag:false: Uses a specific calculation logic (implied "NonLinear" path).trueornull: Uses a different calculation logic. Note that passingnullbehaves identically totrue.
- Calculates the engineering unit value from a raw input using polynomial coefficients defined in
NonLinearStyles NonLinearStyle(Property)- Defaults to
NonLinearStyles.Polynomialif not explicitly set.
- Defaults to
DTS.Common.Classes.Groups.GroupChannel
FilterClass GetFilterClassFromISOCode(ISoftwareFilter[] filters, string isoCodeString)