Skip to content

where does the ModuleInitializer annotation need to be applied / used? #815

Answered by ci-vamp
ci-vamp asked this question in Q&A
Discussion options

You must be logged in to vote

after some experimentation here is what worked:

note you do not need [UsesVerify] like in the example unless you use XUnit. for NUnit this annotation wasnt even available

<project root>/GlobalSnapshotConfig.cs

using System.Runtime.CompilerServices;

namespace API.Test
{
    public static class GlobalSnapshotConfig
    {
        public static readonly string SNAPSHOTS_BASE_DIR_NAME = "snapshots";

        [ModuleInitializer]
        public static void ConfigureVerify()
        {
            InitializeVerifyModules();
            ConfigureSettings();

            // https://github.com/VerifyTests/Verify/blob/main/docs/naming.md#derivepathinfo
            DerivePathInfo(
                (s…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ci-vamp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant