Support
PublicApiSnapshot
SourceCreates deterministic text snapshots of public API declarations for checked-in contract review.
Create
string[] Create(Assembly assembly)
Describes every visible type in assembly
in ordinal order.
Parameters
-
assemblyAssembly whose public and protected contract is inspected.
Returns
Deterministically ordered declaration lines.
AssertMatches
void AssertMatches(Assembly assembly, string copiedBaselineName, string sourceRelativePath)
Asserts the generated snapshot matches its copied baseline, or updates the trusted source baseline.
Parameters
-
assemblyAssembly whose contract is inspected. -
copiedBaselineNameBaseline copied into the test output directory. -
sourceRelativePathTrusted repository-relative baseline path used only in explicit update mode.
Exceptions
-
IOExceptionThrown when a baseline cannot be read or written. -
Xunit.Sdk.EqualExceptionThrown when the reviewed and generated snapshots differ.
Remarks
Set APPSURFACE_UPDATE_PUBLIC_API_BASELINES=1
only for an intentional reviewed API update.
DescribeType
string[] DescribeType(Type type)
Describes one visible type declaration and its visible declared members.
Parameters
-
typeType to inspect.
Returns
The type declaration followed by ordinally sorted member declarations.