C
C#2y ago
QuickZ

TestInitialize runs after constructor causing nullable warnings

I am using the [TestInitialize] attribute on a method to run code only once per complete testrun, and in there initialise your Mocks. This will lead to that you will get the kinda new nullable warnings since this is not run in the constructor. And if you have fields that are not instantiated in the constructor then the intellisense will pick it up as you are exiting the constructor with unasigned fields just having null (this is however the design and accepted). Is there a recommended way of avoiding these warnings?
1 Reply
QuickZ
QuickZ2y ago
And its perhaps about time to remove the server-added name on me? :>