Skip to content

InfluxRepoTests

Namespace: UnitTests.Repositories

Unit tests for the InfluxRepo class, verifying InfluxDB repository operations including data writing and querying functionality.

public class InfluxRepoTests

Inheritance ObjectInfluxRepoTests

Constructors

InfluxRepoTests()

public InfluxRepoTests()

Methods

Constructor_WithEnvironmentVariableHost_ShouldCreateInstance()

Tests that the constructor creates a valid instance when InfluxDB host is provided via environment variable.

public void Constructor_WithEnvironmentVariableHost_ShouldCreateInstance()

Constructor_WithEnvironmentVariableToken_ShouldCreateInstance()

Tests that the constructor creates a valid instance when InfluxDB token is provided via environment variable.

public void Constructor_WithEnvironmentVariableToken_ShouldCreateInstance()

Constructor_WithMissingHost_ShouldThrowArgumentException()

Tests that the constructor throws ArgumentException when InfluxDB host is missing from configuration.

public void Constructor_WithMissingHost_ShouldThrowArgumentException()

Constructor_WithMissingToken_ShouldThrowArgumentException()

Tests that the constructor throws ArgumentException when InfluxDB token is missing from configuration.

public void Constructor_WithMissingToken_ShouldThrowArgumentException()

Constructor_WithNullLogger_ShouldThrowArgumentNullException()

Tests that the constructor throws ArgumentNullException when logger parameter is null.

public void Constructor_WithNullLogger_ShouldThrowArgumentNullException()

Constructor_WithValidConfiguration_ShouldCreateInstance()

Tests that the constructor creates a valid instance when provided with valid configuration.

public void Constructor_WithValidConfiguration_ShouldCreateInstance()

GetOutsideWeatherData_WithException_ShouldLogErrorAndRethrow()

Tests that GetOutsideWeatherData logs error and rethrows exception when an error occurs.

public Task GetOutsideWeatherData_WithException_ShouldLogErrorAndRethrow()

Returns

Task

GetSensorWeatherData_WithException_ShouldLogErrorAndRethrow()

Tests that GetSensorWeatherData logs error and rethrows exception when an error occurs.

public Task GetSensorWeatherData_WithException_ShouldLogErrorAndRethrow()

Returns

Task

GetSensorWeatherData_WithValidParameters_ShouldGenerateCorrectQuery()

Tests that GetSensorWeatherData with valid parameters generates the correct InfluxDB query.

public Task GetSensorWeatherData_WithValidParameters_ShouldGenerateCorrectQuery()

Returns

Task

Setup()

Sets up test fixtures and initializes mocks before each test execution.

public void Setup()

WriteOutsideWeatherData_TemperatureConversion_ShouldConvertCelsiusToFahrenheitCorrectly()

Tests that WriteOutsideWeatherData correctly converts temperature from Celsius to Fahrenheit.

public void WriteOutsideWeatherData_TemperatureConversion_ShouldConvertCelsiusToFahrenheitCorrectly()

WriteSensorData_TimestampConversion_ShouldConvertUnixTimestampCorrectly()

Tests that WriteSensorData correctly converts Unix timestamp to proper DateTime format.

public void WriteSensorData_TimestampConversion_ShouldConvertUnixTimestampCorrectly()

WriteSensorData_WithValidData_ShouldWritePointCorrectly()

Tests that WriteSensorData with valid data writes the point correctly to InfluxDB.

public Task WriteSensorData_WithValidData_ShouldWritePointCorrectly()

Returns

Task