Skip to main content

Creating object vs initialize in constructor


1 comment

  • Andreas Willich

    The difference is, that in the later case, the Calculator instance is created by the Context Injection feature of SpecFlow. This works, because it can easily create an instance of it, as it has no dependencies.

    In this case, this is working, but generally, I suggest only get stuff via Context Injection that is about your automation code. 

    All instances of classes of the subject under test (SUT) I normally create via `new` or using the DI Framework of the SUT to get to instances.


Please sign in to leave a comment.

Powered by Zendesk