// SAMPLE: building-template-request private static TemplateRequest buildTemplateRequest() { var request = new TemplateRequest { RootDirectory = "root directory", SolutionName = "MySolution.sln" }; // Add a project named "MyProject" using a project template named "basic-new-project" request.AddProjectRequest("MyProject", "basic-new-project", project => { // Add some extra templates from the /alterations folder project.Alterations.Add("raven"); project.Alterations.Add("spark"); // Add some substitution values for the templating if desired // See the topic page for subsitutions and inputs project.Substitutions.Set("%SHORT_NAME%", "MyProj"); }); // Add a testing project related to our first project using the "unit-testing" project template // See the topic about testing projects request.AddTestingRequest(new ProjectRequest("MyProject.Testing", "unit-testing", "MyProject")); return request; }
public void validate_missing_testing_template() { var request = new TemplateRequest(); request.AddTemplate("Simple"); request.AddProjectRequest(new ProjectRequest("foo", "MvcApp")); request.AddTestingRequest(new ProjectRequest("foo", "NonExistent", "original")); var missing = request.Validate(theTemplates).Single(); missing.Name.ShouldEqual("NonExistent"); missing.TemplateType.ShouldEqual(TemplateType.Project); missing.ValidChoices.ShouldHaveTheSameElementsAs("MvcApp", "MvcBottle"); }
public void validate_when_everything_matches() { var request = new TemplateRequest(); request.AddTemplate("Simple"); request.Validate(theTemplates).Any().ShouldBeFalse(); request.AddProjectRequest(new ProjectRequest("foo", "MvcApp")); request.Validate(theTemplates).Any().ShouldBeFalse(); request.Projects.Single().Alterations.Add("Assets"); request.AddTestingRequest(new ProjectRequest("foo", "MvcApp", "original")); request.Validate(theTemplates).Any().ShouldBeFalse(); }