I want to overwrite the Program.cs file in a solution I have created for a test, and then compile that solution - as a unit test.
With our library we have in the designer that comes with it a button titled Generate Code. When you click that button it pops up with the code for a sample Program.cs file that calls our library specifically written for the template created in the designer.
We want to have a unit test that verifies that the code we created compiles. We're not testing that it runs, just that it compiles. So the thought is we create a project, replace the Program.cs file in the project, and then compile the project. Successful compile, the test passes. Compile fails, the test fails.
What's driving this is we had a mistake in the code where it had "${name}.compile()"
instead of $"{name}.compile()"
- and that will easily be found with this.
So, can it be done?
Aucun commentaire:
Enregistrer un commentaire