Skip to content

TempServiceTests

Namespace: UnitTests.Services

Unit tests for the TempService class, verifying temperature operations.

public class TempServiceTests

Inheritance ObjectTempServiceTests

Constructors

TempServiceTests()

public TempServiceTests()

Methods

Constructor_WithMissingConfiguration_ShouldThrowInvalidOperationException()

Tests that constructor throws InvalidOperationException when configuration is missing.

public void Constructor_WithMissingConfiguration_ShouldThrowInvalidOperationException()

GetCoordinates_ApiErrorCode_ShouldNotInsert()

Tests that the GetCoordinate function does not insert anything if the api returns a message with an error code.

public Task GetCoordinates_ApiErrorCode_ShouldNotInsert()

Returns

Task

GetCoordinates_WhenExistingEntry_ShouldNotCallAPi()

Tests that the GetCoordinates function does not call the api when there is an entry in the database.

public Task GetCoordinates_WhenExistingEntry_ShouldNotCallAPi()

Returns

Task

GetCoordinates_WhenMissingFields_ShouldNotInsert()

Tests that the GetCoordinates function does not insert anything into the database, when there are missing fields in
the JSON response.

public Task GetCoordinates_WhenMissingFields_ShouldNotInsert()

Returns

Task

GetCoordinates_WhenNoExistingEntry_ShouldCallApi()

Tests that the GetCoordinates function calls the api when there is no existing entry in the database.

public Task GetCoordinates_WhenNoExistingEntry_ShouldCallApi()

Returns

Task

GetCoordinates_WithEmptyJsonArray_ShouldThrowInvalidOperationException()

Tests that GetCoordinates handles empty JSON array response.

public Task GetCoordinates_WithEmptyJsonArray_ShouldThrowInvalidOperationException()

Returns

Task

GetCoordinates_WithNullHttpResponse_ShouldHandleGracefully()

Tests that GetCoordinates handles null HTTP response gracefully.

public Task GetCoordinates_WithNullHttpResponse_ShouldHandleGracefully()

Returns

Task

Setup()

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

public void Setup()

ShowAvailableLocations_WithEmptyData_ShouldReturnEmptyList()

Tests that ShowAvailableLocations returns empty list when no data exists.

public Task ShowAvailableLocations_WithEmptyData_ShouldReturnEmptyList()

Returns

Task

ShowAvailableLocations_WithException_ShouldReturnNull()

Tests that ShowAvailableLocations returns null when exception occurs.

public Task ShowAvailableLocations_WithException_ShouldReturnNull()

Returns

Task

ShowAvailableLocations_WithValidData_ShouldReturnLocations()

Tests that ShowAvailableLocations returns locations when data exists.

public Task ShowAvailableLocations_WithValidData_ShouldReturnLocations()

Returns

Task