{"id":18937504,"url":"https://github.com/verifytests/verify.diffplex","last_synced_at":"2025-06-29T09:04:25.568Z","repository":{"id":42575992,"uuid":"333374078","full_name":"VerifyTests/Verify.DiffPlex","owner":"VerifyTests","description":"Extends Verify to allow comparison of text via DiffPlex.","archived":false,"fork":false,"pushed_at":"2025-06-11T00:09:40.000Z","size":502,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-11T01:23:50.950Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VerifyTests.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"license.txt","code_of_conduct":"code_of_conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"VerifyTests"}},"created_at":"2021-01-27T09:51:38.000Z","updated_at":"2025-06-11T00:09:43.000Z","dependencies_parsed_at":"2024-01-10T03:24:58.385Z","dependency_job_id":"a5f10576-d3ee-4998-8e1a-cc592a30655b","html_url":"https://github.com/VerifyTests/Verify.DiffPlex","commit_stats":{"total_commits":240,"total_committers":5,"mean_commits":48.0,"dds":"0.23333333333333328","last_synced_commit":"e110e4fe951c8de8bb281bd8dea05acfde03d572"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/VerifyTests/Verify.DiffPlex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VerifyTests%2FVerify.DiffPlex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VerifyTests%2FVerify.DiffPlex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VerifyTests%2FVerify.DiffPlex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VerifyTests%2FVerify.DiffPlex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VerifyTests","download_url":"https://codeload.github.com/VerifyTests/Verify.DiffPlex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VerifyTests%2FVerify.DiffPlex/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262566829,"owners_count":23329681,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T12:11:30.560Z","updated_at":"2025-06-29T09:04:25.556Z","avatar_url":"https://github.com/VerifyTests.png","language":"C#","funding_links":["https://github.com/sponsors/VerifyTests"],"categories":[],"sub_categories":[],"readme":"# \u003cimg src=\"/src/icon.png\" height=\"30px\"\u003e Verify.DiffPlex\n\n[![Discussions](https://img.shields.io/badge/Verify-Discussions-yellow?svg=true\u0026label=)](https://github.com/orgs/VerifyTests/discussions)\n[![Build status](https://ci.appveyor.com/api/projects/status/9ug1ufa69m4vf4ph?svg=true)](https://ci.appveyor.com/project/SimonCropp/Verify-DiffPlex)\n[![NuGet Status](https://img.shields.io/nuget/v/Verify.DiffPlex.svg)](https://www.nuget.org/packages/Verify.DiffPlex/)\n\nExtends [Verify](https://github.com/VerifyTests/Verify) to allow [comparison](https://github.com/VerifyTests/Verify/blob/master/docs/comparer.md) of text via [DiffPlex](https://github.com/mmanela/diffplex).\n\n**See [Milestones](../../milestones?state=closed) for release notes.**\n\n\n## Sponsors\n\n\n### Entity Framework Extensions\u003c!-- include: zzz. path: /docs/zzz.include.md --\u003e\n\n[Entity Framework Extensions](https://entityframework-extensions.net/) is a major sponsor and is proud to contribute to the development this project.\n\n[![Entity Framework Extensions](docs/zzz.png)](https://entityframework-extensions.net)\u003c!-- endInclude --\u003e\n\n\n## NuGet\n\n * https://nuget.org/packages/Verify.DiffPlex\n\n\n## Usage\n\n\n### Initialize\n\nCall `VerifyDiffPlex.Initialize()` in a `[ModuleInitializer]`. Alternatively, use `VerifyDiffPlex.Initialize(OutputType.Full)`, `VerifyDiffPlex.Initialize(OutputType.Compact)` or `VerifyDiffPlex.Initialize(OutputType.Minimal)` to specify the type of output (see below).\n\n\u003c!-- snippet: ModuleInitializer.cs --\u003e\n\u003ca id='snippet-ModuleInitializer.cs'\u003e\u003c/a\u003e\n```cs\npublic static class ModuleInitializer\n{\n\n    [ModuleInitializer]\n    public static void Initialize() =\u003e\n        VerifyDiffPlex.Initialize();\n\n\n    [ModuleInitializer]\n    public static void OtherInitialize()\n    {\n        VerifierSettings.InitializePlugins();\n        VerifierSettings.ScrubLinesContaining(\"DiffEngineTray\");\n        VerifierSettings.IgnoreStackTrace();\n    }\n}\n```\n\u003csup\u003e\u003ca href='/src/Tests/ModuleInitializer.cs#L1-L16' title='Snippet source file'\u003esnippet source\u003c/a\u003e | \u003ca href='#snippet-ModuleInitializer.cs' title='Start of snippet'\u003eanchor\u003c/a\u003e\u003c/sup\u003e\n\u003c!-- endSnippet --\u003e\n\n\n### Verify text\n\nGiven an existing verified file:\n\n```\nThe\nbefore\ntext\n```\n\nAnd a test:\n\n```cs\n[Test]\npublic async Task Sample()\n{\n    var target = @\"The\nafter\ntext\";\n    await Verifier.Verify(target);\n}\n```\n\n\n### Diff results\n\nWhen the comparison fails, the resulting differences will be included in the test result displayed to the user. This example shows the `Full` style of output.\n\n```txt\nResults do not match.\nDifferences:\nReceived: Tests.Sample.received.txt\nVerified: Tests.Sample.verified.txt\nCompare Result:\n  The\n- before\n+ after\n  text\n```\n\n\n### Output types\n\nThe library currently supports three different types of diff outputs; the desired type can be specified during library initialization.\n\n\u003c!-- snippet: OutputTypeCompact --\u003e\n\u003ca id='snippet-OutputTypeCompact'\u003e\u003c/a\u003e\n```cs\n[ModuleInitializer]\npublic static void Init() =\u003e\n    VerifyDiffPlex.Initialize(OutputType.Compact);\n```\n\u003csup\u003e\u003ca href='/src/CompactTests/Tests.cs#L6-L12' title='Snippet source file'\u003esnippet source\u003c/a\u003e | \u003ca href='#snippet-OutputTypeCompact' title='Start of snippet'\u003eanchor\u003c/a\u003e\u003c/sup\u003e\n\u003c!-- endSnippet --\u003e\n\n`OutputType.Full` is the default. It shows the full contents of the received file, with differences with the received file indicated by `+` and `-`. Here's an example of `Full` output.\n\n```\n  First line\n- Second line\n+ Second line changed\n  Third line\n  Fourth line\n  Fifth line\n- Sixth line\n+ Sixth line changed\n  Seventh line\n  Eighth line\n```\n\nThis output type gives the most information, but if verified files are long, it can be difficult to read through and find the actual differences. `OutputType.Compact` will show only the changed lines, with one line of context (with line number) before and after each changed section to help identify where the change is.\n\n```\n1 First line\n- Second line\n+ Second line changed\n3 Third line\n\n5 Fifth line\n- Sixth line\n+ Sixth line changed\n7 Seventh line\n```\n\nLastly, there is `OutputType.Minimal` which will show only the changed lines.\n\n```\n- Second line\n+ Second line changed\n- Sixth line\n+ Sixth line changed\n```\n\n\n### Test level settings\n\nDiffPlex can be used at the test level:\n\n\u003c!-- snippet: TestLevelUsage --\u003e\n\u003ca id='snippet-TestLevelUsage'\u003e\u003c/a\u003e\n```cs\n[Test]\npublic Task TestLevelUsage()\n{\n    var target = \"The text\";\n    var settings = new VerifySettings();\n    settings.UseDiffPlex();\n    return Verify(target, settings);\n}\n```\n\u003csup\u003e\u003ca href='/src/Tests/Tests.cs#L111-L122' title='Snippet source file'\u003esnippet source\u003c/a\u003e | \u003ca href='#snippet-TestLevelUsage' title='Start of snippet'\u003eanchor\u003c/a\u003e\u003c/sup\u003e\n\u003c!-- endSnippet --\u003e\n\nOr Fluently\n\n\u003c!-- snippet: TestLevelUsageFluent --\u003e\n\u003ca id='snippet-TestLevelUsageFluent'\u003e\u003c/a\u003e\n```cs\n[Test]\npublic Task TestLevelUsageFluent()\n{\n    var target = \"The text\";\n    return Verify(target)\n        .UseDiffPlex();\n}\n```\n\u003csup\u003e\u003ca href='/src/Tests/Tests.cs#L124-L134' title='Snippet source file'\u003esnippet source\u003c/a\u003e | \u003ca href='#snippet-TestLevelUsageFluent' title='Start of snippet'\u003eanchor\u003c/a\u003e\u003c/sup\u003e\n\u003c!-- endSnippet --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fverifytests%2Fverify.diffplex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fverifytests%2Fverify.diffplex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fverifytests%2Fverify.diffplex/lists"}