TopicControllerTests¶
Namespace: UnitTests.Controllers
Unit tests for the TopicController class, verifying MQTT topic management functionality.
Inheritance Object → TopicControllerTests
Constructors¶
TopicControllerTests()¶
Methods¶
Constructor_WithNullSettingsRepo_ShouldThrowArgumentNullException()¶
Tests that the constructor throws ArgumentNullException when settings repository is null.
Constructor_WithValidParameters_ShouldCreateInstance()¶
Tests that the constructor creates a valid instance when provided with valid parameters.
CreateTopic_WithException_ShouldReturnInternalServerError()¶
Tests that CreateTopic returns InternalServerError when service throws exception.
Returns¶
CreateTopic_WithInvalidModelState_ShouldReturnBadRequest()¶
Tests that CreateTopic returns BadRequest when model state is invalid.
Returns¶
CreateTopic_WithNullTopic_ShouldReturnBadRequest()¶
Tests that CreateTopic returns BadRequest when topic setting is null.
Returns¶
CreateTopic_WithValidTopic_ShouldReturnCreated()¶
Tests that CreateTopic returns Created when topic is created successfully.
Returns¶
DeleteTopic_WithException_ShouldReturnInternalServerError()¶
Tests that DeleteTopic returns InternalServerError when service throws exception.
Returns¶
DeleteTopic_WithNullTopic_ShouldReturnBadRequest()¶
Tests that DeleteTopic returns BadRequest when topic setting is null.
Returns¶
DeleteTopic_WithValidTopic_ShouldReturnOk()¶
Tests that DeleteTopic returns OK when topic is deleted successfully.
Returns¶
GetAllTopics_WithEmptyData_ShouldReturnOkWithEmptyList()¶
Tests that GetAllTopics returns OK with empty list when no topics exist.
Returns¶
GetAllTopics_WithException_ShouldReturnInternalServerError()¶
Tests that GetAllTopics returns InternalServerError when service throws exception.
Returns¶
GetAllTopics_WithValidData_ShouldReturnOkWithTopics()¶
Tests that GetAllTopics returns OK with topics when service returns data.
Returns¶
Setup()¶
Sets up test fixtures and initializes mocks before each test execution.
UpdateTopic_WithException_ShouldReturnInternalServerError()¶
Tests that UpdateTopic returns InternalServerError when service throws exception.
Returns¶
UpdateTopic_WithNullTopic_ShouldReturnBadRequest()¶
Tests that UpdateTopic returns BadRequest when topic setting is null.
Returns¶
UpdateTopic_WithValidTopic_ShouldReturnOk()¶
Tests that UpdateTopic returns OK when topic is updated successfully.