LocationControllerTests¶
Namespace: UnitTests.Controllers
Unit tests for the TempController class, verifying temperature operations and location management functionality.
Inheritance Object → LocationControllerTests
Constructors¶
LocationControllerTests()¶
Methods¶
Constructor_WithValidParameters_ShouldCreateInstance()¶
Tests that the constructor creates a valid instance when provided with valid parameters.
GetAllPostalcodes_WithEmptyData_ShouldReturnOkWithEmptyList()¶
Tests that GetAllPostalcodes returns OK with empty list when no postal codes exist.
Returns¶
GetAllPostalcodes_WithException_ShouldLogError()¶
Tests that GetAllPostalcodes logs error when exception occurs.
Returns¶
GetAllPostalcodes_WithException_ShouldReturnInternalServerError()¶
Tests that GetAllPostalcodes returns InternalServerError when service throws exception.
Returns¶
GetAllPostalcodes_WithValidData_ShouldReturnOkWithPostalcodes()¶
Tests that GetAllPostalcodes returns OK with postal codes when service returns data.
Returns¶
InsertLocation_WithGenericException_ShouldReturnInternalServerError()¶
Tests that InsertLocation returns InternalServerError when generic exception is thrown.
Returns¶
InsertLocation_WithInvalidOperationException_ShouldLogError()¶
Tests that InsertLocation logs error when InvalidOperationException occurs.
Returns¶
InsertLocation_WithInvalidOperationException_ShouldReturnBadRequest()¶
Tests that InsertLocation returns InternalServerError when InvalidOperationException is thrown.
Returns¶
InsertLocation_WithValidPostalcode_ShouldReturnOk()¶
Tests that InsertLocation returns OK when location is inserted successfully.
Returns¶
RemovePostalcode_WithException_ShouldLogError()¶
Tests that RemovePostalcode logs error when exception occurs.
Returns¶
RemovePostalcode_WithException_ShouldReturnInternalServerError()¶
Tests that RemovePostalcode returns InternalServerError when exception is thrown.
Returns¶
RemovePostalcode_WithValidPostalcode_ShouldReturnOk()¶
Tests that RemovePostalcode returns OK when postal code is removed successfully.
Returns¶
Setup()¶
Sets up test fixtures and initializes mocks before each test execution.