Table of Contents

Class ApplicationDatabaseHealthCheckTests

Namespace
ProjectTemplate.Web.Tests
Assembly
ProjectTemplate.Web.Tests.dll

Provides tests for the application database readiness check.

public sealed class ApplicationDatabaseHealthCheckTests
Inheritance
ApplicationDatabaseHealthCheckTests
Inherited Members

Remarks

These tests build the service collection directly instead of using the web application factory. The data access connection string is resolved when services are registered, which is before the factory's test configuration is applied, so a factory-based test cannot point the application at a specific database.

Methods

Readiness_CheckDisabled_ReportsHealthyWithoutContactingDatabase()

Verifies that the check reports healthy without contacting the database when it is disabled.

[Fact("/home/runner/work/NetCoreApplicationTemplate/NetCoreApplicationTemplate/tests/ProjectTemplate.Web.Tests/ApplicationDatabaseHealthCheckTests.cs", 64)]
public Task Readiness_CheckDisabled_ReportsHealthyWithoutContactingDatabase()

Returns

Task

A task that represents the asynchronous test operation.

Readiness_DataAccessDisabled_RegistersNoDatabaseCheck()

Verifies that no database readiness check is registered when data access is disabled.

[Fact("/home/runner/work/NetCoreApplicationTemplate/NetCoreApplicationTemplate/tests/ProjectTemplate.Web.Tests/ApplicationDatabaseHealthCheckTests.cs", 81)]
public Task Readiness_DataAccessDisabled_RegistersNoDatabaseCheck()

Returns

Task

A task that represents the asynchronous test operation.

Readiness_DatabaseAvailable_ReportsHealthy()

Verifies that readiness is healthy when the SQLite database file exists.

[Fact("/home/runner/work/NetCoreApplicationTemplate/NetCoreApplicationTemplate/tests/ProjectTemplate.Web.Tests/ApplicationDatabaseHealthCheckTests.cs", 40)]
public Task Readiness_DatabaseAvailable_ReportsHealthy()

Returns

Task

A task that represents the asynchronous test operation.

Readiness_DatabaseUnavailable_ReportsUnhealthy()

Verifies that readiness is unhealthy when the SQLite database file does not exist.

[Fact("/home/runner/work/NetCoreApplicationTemplate/NetCoreApplicationTemplate/tests/ProjectTemplate.Web.Tests/ApplicationDatabaseHealthCheckTests.cs", 23)]
public Task Readiness_DatabaseUnavailable_ReportsUnhealthy()

Returns

Task

A task that represents the asynchronous test operation.