Skip to content

LocationControllerTests

Namespace: UnitTests.Controllers

Unit tests for the TempController class, verifying temperature operations and location management functionality.

public class LocationControllerTests

Inheritance ObjectLocationControllerTests

Constructors

LocationControllerTests()

public LocationControllerTests()

Methods

Constructor_WithValidParameters_ShouldCreateInstance()

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

public void Constructor_WithValidParameters_ShouldCreateInstance()

GetAllPostalcodes_WithEmptyData_ShouldReturnOkWithEmptyList()

Tests that GetAllPostalcodes returns OK with empty list when no postal codes exist.

public Task GetAllPostalcodes_WithEmptyData_ShouldReturnOkWithEmptyList()

Returns

Task

GetAllPostalcodes_WithException_ShouldLogError()

Tests that GetAllPostalcodes logs error when exception occurs.

public Task GetAllPostalcodes_WithException_ShouldLogError()

Returns

Task

GetAllPostalcodes_WithException_ShouldReturnInternalServerError()

Tests that GetAllPostalcodes returns InternalServerError when service throws exception.

public Task GetAllPostalcodes_WithException_ShouldReturnInternalServerError()

Returns

Task

GetAllPostalcodes_WithValidData_ShouldReturnOkWithPostalcodes()

Tests that GetAllPostalcodes returns OK with postal codes when service returns data.

public Task GetAllPostalcodes_WithValidData_ShouldReturnOkWithPostalcodes()

Returns

Task

InsertLocation_WithGenericException_ShouldReturnInternalServerError()

Tests that InsertLocation returns InternalServerError when generic exception is thrown.

public Task InsertLocation_WithGenericException_ShouldReturnInternalServerError()

Returns

Task

InsertLocation_WithInvalidOperationException_ShouldLogError()

Tests that InsertLocation logs error when InvalidOperationException occurs.

public Task InsertLocation_WithInvalidOperationException_ShouldLogError()

Returns

Task

InsertLocation_WithInvalidOperationException_ShouldReturnBadRequest()

Tests that InsertLocation returns InternalServerError when InvalidOperationException is thrown.

public Task InsertLocation_WithInvalidOperationException_ShouldReturnBadRequest()

Returns

Task

InsertLocation_WithValidPostalcode_ShouldReturnOk()

Tests that InsertLocation returns OK when location is inserted successfully.

public Task InsertLocation_WithValidPostalcode_ShouldReturnOk()

Returns

Task

RemovePostalcode_WithException_ShouldLogError()

Tests that RemovePostalcode logs error when exception occurs.

public Task RemovePostalcode_WithException_ShouldLogError()

Returns

Task

RemovePostalcode_WithException_ShouldReturnInternalServerError()

Tests that RemovePostalcode returns InternalServerError when exception is thrown.

public Task RemovePostalcode_WithException_ShouldReturnInternalServerError()

Returns

Task

RemovePostalcode_WithValidPostalcode_ShouldReturnOk()

Tests that RemovePostalcode returns OK when postal code is removed successfully.

public Task RemovePostalcode_WithValidPostalcode_ShouldReturnOk()

Returns

Task

Setup()

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

public void Setup()