Files
DP44/enriched-qwen3-coder-next/Common/DTS.Common.Tests.md
2026-04-17 14:55:32 -04:00

2.7 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.Common.Tests/ChannelTypeUtilityShould.cs
Common/DTS.Common.Tests/NetworkUtilsShould.cs
Common/DTS.Common.Tests/LinearizationFormulaShould.cs
Common/DTS.Common.Tests/GroupChannelShould.cs
Common/DTS.Common.Tests/FilterClassShould.cs
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.Empty if the input is null, empty, has fewer than 2 characters, or starts with an unknown 2-character prefix.
    • Returns the string representation of a KnownChannelTypes enum 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 true and populates ipAddress (stripped of port and protocol) if a valid IP is found.
    • Returns false for 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 proportional flag:
      • false: Uses a specific calculation logic (implied "NonLinear" path).
      • true or null: Uses a different calculation logic. Note that passing null behaves identically to true.
  • NonLinearStyles NonLinearStyle (Property)
    • Defaults to NonLinearStyles.Polynomial if not explicitly set.

DTS.Common.Classes.Groups.GroupChannel

  • FilterClass GetFilterClassFromISOCode(ISoftwareFilter[] filters, string isoCodeString)