Integration tests ensure that an app's components function correctly at a level that includes the app's supporting infrastructure, such as the database, file system, and network. ASP.NET Core supports integration tests using a unit test framework with a test web host and an in-memory test server.

The sample app is a Razor Pages app and assumes a basic understanding of Razor Pages. If unfamiliar with Razor Pages, see the following topics:

Introduction to integration tests

Integration tests evaluate an app's components on a broader level than
unit tests
. Unit tests are used to test isolated software components, such as individual class methods. Integration tests confirm that two or more app components work together to produce an expected result, possibly including every component required to fully process a request.

These broader tests are used to test the app's infrastructure and whole framework, often including the following components:

Unit tests use fabricated components, known as
fakes
or
mock objects
, in place of infrastructure components.

In contrast to unit tests, integration tests:

Therefore, limit the use of integration tests to the most important infrastructure scenarios. If a behavior can be tested using either a unit test or an integration test, choose the unit test.

Tip

Don't write integration tests for every possible permutation of data and file access with databases and file systems. Regardless of how many places across an app interact with databases and file systems, a focused set of read, write, update, and delete integration tests are usually capable of adequately testing database and file system components. Use unit tests for routine tests of method logic that interact with these components. In unit tests, the use of infrastructure fakes/mocks result in faster test execution.

Note

In discussions of integration tests, the tested project is frequently called the , or "SUT" for short.

Integration tests in ASP.NET Core require the following:

Integration tests follow a sequence of events that include the usual
Arrange
,
Act
, and
Assert
test steps:

Usually, the test web host is configured differently than the app's normal web host for the test runs. For example, a different database or different app settings might be used for the tests.

O
ne of the central themes of Tocqueville’s thought is that a political movement, or (at a later stage) a political regime, may be undone by its very success.
1
University of Notre Dame professor Patrick J. Deneen shows himself to be a worthy successor of Tocqueville by updating his teacher’s theme, applying it neither to democratic revolution nor to steady-state democracy, but to liberalism. In a cutting style that sustains its momentum throughout, Deneen addresses the widespread sense that liberalism is visibly teetering, and demonstrates with great power that the very successes of liberalism have undermined its own foundations.

By itself this would be enough to make the book a triumph. It is therefore churlish to wish for more, yet, I will play the churl. At the stage of diagnosis, Deneen is masterful; at the stage of prescription, he relapses into liberalism (or more accurately, as I will explain, into liberalism’s false image of itself). At the stage of diagnosis, Deneen proves beyond a reasonable doubt that liberalism claims to eschew comprehensive substantive theories of the good, yet inevitably embeds and enforces just such a comprehensive substantive theory, based on a particular and erroneous anthropology. At the stage of prescription, puzzlingly, Deneen tries to eschew any competing comprehensive theory and plumps for a vague communitarian localism, which can finally exist only at the sufferance of the aggressive liberal state. In that sense the diagnosis itself undercuts the prescription, suggesting that the retreat into local communities is at best a precarious maneuver.

Given this complaint, I will undertake a kind of Deneen fan fiction, offering an alternative ending to the
book—one
that is, I believe, more consistent with Deneen’s own argument. In the alternate ending, rather than retreating to a nostalgic localism, nonliberal actors strategically locate themselves within liberal institutions and work to undo the liberalism of the state from within. These actors possess a substantive comprehensive theory of the good, and seize opportunities to bring about its fulfillment through and by means of the very institutional machinery that the liberal state has providentially created. Then and only then will the liberal state, reintegrated from within, finally and truly become a victim of its own success.