Replies: 1 comment
-
I've raised a pr for autofixture support. Let's revisit this after |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am still experimenting on some way to use TUnit in conjunction with AutoFixture.
The basics now work super fine.
In the end a test is a flow through different steps. So in the brain of a test developer the test class is constructed and then the method is called. Basically this is how TUnit works, but TUnit is creating the parameters upfront, before creating the ctor paramaters. Due to the customizations order is in AutoFixture based tests very important.
In my approach there is a fixture factory in the background and the first time any component needs a fixture it is created and stored in the TestBuilderContext.
I show some code what I am trying to do:
Given 2 classes sharing a dependency:
Now lets write a simple test using a frozen dependency:
Of course with the current TUnit these tests fail, cause the AutoDataAttribute is called before the AutoClassConstructor. For this to work I would need it the other way round.
Or is there some other trick to code this working?
Beta Was this translation helpful? Give feedback.
All reactions