Quick question, I\'m using the Visual Studio\'s testing framework for unit testing. Just wondering what\'s the difference between using the constructor to do initialization work
Conceptually they are they same, as MSTest creates a new instance of your test class before each test execution. However, technically there are a few differences:
TestInitialize
(no surprise as the latter is an instance method).TestContext
in TestInitialize
.TestInitialize
: https://stackoverflow.com/a/8689398/67824.readonly
fields in the ctor. I think it's pretty important: https://stackoverflow.com/a/45270180/67824.