TempServiceTests¶
Namespace: UnitTests.Services
Unit tests for the TempService class, verifying temperature operations.
Inheritance Object → TempServiceTests
Constructors¶
TempServiceTests()¶
Methods¶
Constructor_WithMissingConfiguration_ShouldThrowInvalidOperationException()¶
Tests that constructor throws InvalidOperationException when configuration is missing.
GetCoordinates_ApiErrorCode_ShouldNotInsert()¶
Tests that the GetCoordinate function does not insert anything if the api returns a message with an error code.
Returns¶
GetCoordinates_WhenExistingEntry_ShouldNotCallAPi()¶
Tests that the GetCoordinates function does not call the api when there is an entry in the database.
Returns¶
GetCoordinates_WhenMissingFields_ShouldNotInsert()¶
Tests that the GetCoordinates function does not insert anything into the database, when there are missing fields in
the JSON response.
Returns¶
GetCoordinates_WhenNoExistingEntry_ShouldCallApi()¶
Tests that the GetCoordinates function calls the api when there is no existing entry in the database.
Returns¶
GetCoordinates_WithEmptyJsonArray_ShouldThrowInvalidOperationException()¶
Tests that GetCoordinates handles empty JSON array response.
Returns¶
GetCoordinates_WithNullHttpResponse_ShouldHandleGracefully()¶
Tests that GetCoordinates handles null HTTP response gracefully.
Returns¶
Setup()¶
Sets up test fixtures and initializes mocks before each test execution.
ShowAvailableLocations_WithEmptyData_ShouldReturnEmptyList()¶
Tests that ShowAvailableLocations returns empty list when no data exists.
Returns¶
ShowAvailableLocations_WithException_ShouldReturnNull()¶
Tests that ShowAvailableLocations returns null when exception occurs.
Returns¶
ShowAvailableLocations_WithValidData_ShouldReturnLocations()¶
Tests that ShowAvailableLocations returns locations when data exists.