Skip to content

FAQ

I Would Like to Add an Additional Type

Mock Magic includes an extension seam: call Mock.RegisterToken(name, factory) or Mock.RegisterGenerator<T>(name, factory) to add your own data type without modifying the package. Registered names are immediately usable as {{name}} tokens inside Mock.Parse. For built-in additions you'd like to see in the package, contact me on Discord.

How Do I Make Tests Reproducible?

Call Mock.Seed(seed) at the start of the run and pair it with Mock.UseDateReference(...) for date-sensitive output. When the deterministic section ends, call Mock.ResetSeed() and Mock.UseDateReference((System.DateTime?)null), preferably in a finally block. The Generator window's Stable mode applies the same idea for editor previews.