ConnectionTests¶
Namespace: UnitTests.MqttReceiver
Unit tests for the Connection class, verifying MQTT connection management and message processing functionality.
Inheritance Object → ConnectionTests
Constructors¶
ConnectionTests()¶
Methods¶
Constructor_ReadsConfigurationValues_Successfully()¶
Tests that the constructor properly reads configuration values.
Constructor_WithNullConfiguration_ThrowsArgumentNullException()¶
Tests that the Connection constructor throws when configuration is null.
Constructor_WithNullLogger_ThrowsArgumentNullException()¶
Tests that the Connection constructor throws when logger is null.
Constructor_WithNullServiceProvider_ThrowsArgumentNullException()¶
Tests that the Connection constructor throws when service provider is null.
Constructor_WithValidDependencies_InitializesSuccessfully()¶
Tests that the Connection constructor properly initializes with valid dependencies.
JsonDeserialization_InvalidJson_ThrowsJsonException()¶
Tests deserialization of invalid JSON.
JsonDeserialization_ValidSensorReading_DeserializesCorrectly()¶
Tests deserialization of valid sensor reading JSON.
JsonSerializerOptions_AreConfiguredCorrectly()¶
Tests that JSON serializer options are properly configured.
ProcessBatchSensorReading_WithMetaData_ProcessesAllReadings()¶
Tests processing of batch sensor readings with meta data.
Returns¶
ProcessSensorReading_DatabaseError_HandlesGracefully()¶
Tests that database write errors are handled gracefully.
Returns¶
ProcessSensorReading_EmptyValueArray_SkipsProcessing()¶
Tests processing of sensor reading with empty value array.
Returns¶
ProcessSensorReading_NullValue_SkipsProcessing()¶
Tests processing of sensor reading with null value.
Returns¶
ProcessSensorReading_ValidSingleReading_WritesToDatabase()¶
Tests processing of a valid single sensor reading message using reflection.
Returns¶
Setup()¶
Sets up test fixtures and initializes mocks before each test execution.