ModuleInitializer in .NET Framework
              
              #1445
            
            Replies: 3 comments 2 replies
-
| 
         does this clarify things? https://github.com/VerifyTests/Verify?tab=readme-ov-file#static-settings  | 
  
Beta Was this translation helpful? Give feedback.
-
        
 usually when i see people wrapping the Verify method, it is an anti-pattern. can you share your wrapper code so i can review it?  | 
  
Beta Was this translation helpful? Give feedback.
-
        
 I can't believe I missed that in the docs 😅 
 Yeah it's not the best solution. I didn't do this, I just mentioned it as a potential solution I'd considered. Thanks for your help, I'm a massive fan of verify 👍  | 
  
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey, reading the docs it suggests that I use
ModuleInitializerto run initialisation code. This works great in .NET 5+ but what do I do for .NET Framework as it is not supported? Is there a pattern or trick here?My current solution is to use a
try catchstatic constructor to run the setup code for the test file that usesVerify. Other than that my only other solution is to wrap the setup code in atry catchstatement and and run it every time I call aVerifymethod wrapperBeta Was this translation helpful? Give feedback.
All reactions