Files
DP44/docs/ai/DataPRO/StateMachine.Tests.md
2026-04-17 14:55:32 -04:00

1.8 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
DataPRO/StateMachine.Tests/StatesShould.cs
2026-04-17T16:14:08.282619+00:00 zai-org/GLM-5-FP8 1 f3b6a750e8952451

StateMachine.Tests

Purpose

This module contains unit tests for a singleton States factory class within the DTS.DASLib.Service.StateMachine namespace. It verifies that the States singleton is correctly initialized, that it maps State enum values to the correct IDASState instances, and that the IDASFactory dependency is properly propagated to all state instances.

Public Interface

  • StatesShould (TestFixture)
    • void Instance_ShouldNotBeNull(): Verifies that the States.Instance singleton property returns a non-null reference.
    • void Instance_ShouldBeSame(): Verifies that States.Instance returns the same reference on subsequent calls (Singleton pattern guarantee).
    • void States_ShouldReturnCorrectInstanceOfState(): Verifies that specific properties on the States instance (e.g., Arm, Arming, Configure) return objects with the corresponding State enum value.
    • void GetIDASState_ReturnAllKnownStates(): Iterates through all defined values of the State enum and verifies that States.Instance.GetIDASState(State) returns an object with a matching State property.
    • void GetIDASState_ShouldThrowException_WithUndefinedState(): Verifies that calling GetIDASState with an invalid enum value (cast from integer 45) throws an InvalidOperationException with the message "Undefined State".
    • void SetDASFactory_ShouldSetToAnInstanceOfDASFactory(): Verifies that States.SetDASFactory(IDASFactory) correctly injects the factory into all state instances retrieved via GetIDASState.

Invariants

  • Singleton Pattern: States.Instance must always return the same object reference.