Skip to content

TestWriter class

Ershad Raoufi- ارشاد رئوفی edited this page Mar 20, 2023 · 2 revisions

This code defines a static class TestWriter in the TestCreator.Core namespace that provides methods to generate unit test files for enums in a given set of assemblies. The class provides four overloaded methods with different parameters to support various use cases.

The first method CreateUnitTestFilesFromAssemblies takes in the path where the test files will be created, a list of assembly names in selectedAssembly, an assertType and a unitTestFrameworkType to be used for the generated test files. It also provides a overWriteTests flag to overwrite existing test files if they exist. This method validates the input parameters and delegates the actual creation of the test files to a DefaultUnitTestWriter instance.

The second method CreateUnitTestFilesFromAssemblies takes the same input parameters as the first method, but instead of assertType and unitTestFrameworkType, it takes a BaseUnitTestWriter instance. This method validates the input parameters and delegates the actual creation of the test files to the passed BaseUnitTestWriter instance.

The third and fourth methods are similar to the first two methods, but instead of a list of assembly names, they take a Dictionary of assembly names and their corresponding paths where the test files will be created.

Overall, this class provides a simple API to generate unit test files for enums in a set of assemblies. The generated test files use the selected assertType and unitTestFrameworkType. The actual creation of test files is delegated to DefaultUnitTestWriter or a passed BaseUnitTestWriter instance.

Clone this wiki locally