liveBook · Manning

Verify

As explained in .NET in Action, Second Edition

Verify is a .NET snapshot-testing library that compares test results with approved files.

Verify is a .NET snapshot-testing library that compares test output with an approved version and fails when the output changes. It makes important SQL changes visible during code review without pretending to prevent every database problem. section 9.4.1

A practical SQL verification workflow:

  • Capture Entity Framework Core SQL through a database interceptor and write the commands to test output or a stream. section 9.4.1
  • Use Verify or Verify.EntityFramework to compare the captured SQL with its accepted version. section 9.4.1
  • Review intentional differences when a LINQ or schema change produces different SQL. section 9.4.1

Detecting an unintended query change

A test records the SQL generated for catalog operations. Verify compares that recording with the approved result; a changed query fails the test and requires the change author and reviewers to acknowledge it. section 9.4.1

How .NET in Action, Second Edition covers it

How deep it goes
Defines output comparison and demonstrates SQL capture, but defers foolproof prevention of database problems.
Examples
Uses intercepted catalog SQL, including queries for creating, updating, and deleting books and ratings.
What it assumes
Assumes familiarity with .NET tests, Entity Framework Core, interceptors, and generated SQL.
What you can do after
Diagnose SQL regressions by comparing intercepted queries with approved output.
How it connects
Connects snapshot testing with Entity Framework Core, database interceptors, LINQ queries, SQL performance, and security.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of .NET in Action, Second Edition. The section links point to the parts of the book it draws on.