Skip to content

WorkerTests

Namespace: UnitTests.MqttReceiver

Unit tests for the Worker class, verifying background service orchestration functionality.

public class WorkerTests

Inheritance ObjectWorkerTests

Constructors

WorkerTests()

public WorkerTests()

Methods

Constructor_WithNullLogger_ThrowsArgumentNullException()

Tests that the Worker constructor throws when logger is null.

public void Constructor_WithNullLogger_ThrowsArgumentNullException()

Constructor_WithNullReceiver_ThrowsArgumentNullException()

Tests that the Worker constructor throws when receiver is null.

public void Constructor_WithNullReceiver_ThrowsArgumentNullException()

Constructor_WithValidDependencies_InitializesSuccessfully()

Tests that the Worker constructor properly initializes with valid dependencies.

public void Constructor_WithValidDependencies_InitializesSuccessfully()

Dispose_DisposesWithoutException()

Tests that the worker disposes properly.

public void Dispose_DisposesWithoutException()

Dispose_MultipleCalls_DoesNotThrow()

Tests that the worker can be disposed multiple times without exception.

public void Dispose_MultipleCalls_DoesNotThrow()

ExecuteAsync_WithCancellationToken_CompletesGracefully()

Tests that ExecuteAsync handles cancellation token properly.

public Task ExecuteAsync_WithCancellationToken_CompletesGracefully()

Returns

Task

Setup()

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

public void Setup()

TearDown()

Cleans up resources after each test execution.

public void TearDown()