Schlagwort: Testing

  • SonarQube Code Duplicates

    Sometimes you need to copy code between different projects for several reasons. It is required that the same class has to be in both projects e.g. a class that is compiled with different frameworks. But this has a negative impact on code analysis results regarding code duplicates. So let’s take an analysis result of a…

  • Dynamically create a generic using reflection

    A long time ago I created a class which helps create a sut for unit testing. This class is generic and has the type of the sut as a generic parameter. Details see ContextFor<> zum Testen des SUT. Now, I was trying to use the `ContextFor<T>` in a data-driven test which passes the type as…

  • Lazy loading of assemblies can be tricky

    NUnit error message on data-driven test: `Test` is Inconclusive ReSharper Test Runner warning: Element `Test` was left pending after its run completion. Recently I was doing some testing and trying to check if all classes have a corresponding test class. Therefore I used data-driven NUnit tests, which uses a list of all classes in non-test…

  • ContextFor<> zum Testen des SUT

    In meinen Projekte der letzten Jahren ist mit der Zeit eine Hilfsklasse fürs Testen entstanden. Das Problem war das Erstellen des SUT mittels Konstruktor, welcher bei Dependency Injection entsprechend viele Paramter hat oder haben kann. Hier ein Beispiel mit „nur“ 5 Konstruktor Parameter. Dadurch ist Builder entstanden, welcher für jeden Konstruktor Parameter des SUT ein…