https://github.com/chamons/macios-test-template
A prototype msbuild test templating system
https://github.com/chamons/macios-test-template
Last synced: 7 months ago
JSON representation
A prototype msbuild test templating system
- Host: GitHub
- URL: https://github.com/chamons/macios-test-template
- Owner: chamons
- License: mit
- Created: 2019-02-21T21:08:06.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-21T22:54:46.000Z (almost 7 years ago)
- Last Synced: 2025-03-13T19:16:27.788Z (10 months ago)
- Language: C#
- Size: 234 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Test template prototype for xamarin-macios
Today testing msbuild projects in macios is divided into two seperate systems:
- Xamarin.iOS uses in-process msbuild tests that are checked into source control.
- Xamarin.Mac uses out-of-process msbuild tests that are generated from the tests.
I prefer the Xamarin.Mac solution, however the infrastructure used to generate
those tests was organically grown (overgrew) over time and needs a serious cleanup pass.
In addition, it was hard coded strongly towards Xamarin.Mac'isms.
This project is a prototype for an alternative that could be shared and more easily extended.
## How to use the API
- You instance a TemplateEngine subclass either with a TemplateInfo or your flavor\language
* MacAppTemplateEngine
* MacBindingTemplateEngine
* MacClassicAppTemplateEngine
* MacLibraryTemplateEngine
* MacSystemMonoTemplateEngine
* NetStandardTemplateEngine
- Create a number of Substitutions classes (FileSubstitutions, PListSubstitutions, ProjectSubstitutions) which describe how you want to fill in the "holes" in the templates.
- You call a Generate method passing in those substitutions and any additional options.
### Example
```csharp
var tmpDir = Cache.CreateTemporaryDirectory ();
var engine = new MacAppTemplateEngine (ProjectFlavor.FullXM, ProjectLanguage.CSharp);
var fileSubstitutions = new FileSubstitutions { TestCode = "System.Console.WriteLine (typeof (int));" };
var projectSubstitutions = new ProjectSubstitutions {
References = "",
};
string projectPath = engine.Generate (tmpDir, projectSubstitutions, fileSubstitutions);
ProjectBuilder.BuildProject (projectPath, "/"); /* Use system XM instead of _mac-build today */
```