public void build_request_copies_inputs_around_substitutions() { var graph = new TemplateGraph(); graph.AddCategory("new").Templates.Add(new ProjectTemplate { Name = "Foo", Template = "FooProj", Alterations = new List <string> { "Foo1", "Foo2" } }); var choices = new TemplateChoices { Category = "new", ProjectType = "Foo", ProjectName = "MyFoo" }; choices.Inputs["Foo1"] = "A"; choices.Inputs["Foo2"] = "B"; choices.Inputs["Foo3"] = "C"; ProjectRequest request = graph.BuildProjectRequest(choices); request.Substitutions.ValueFor("Foo1").ShouldEqual("A"); request.Substitutions.ValueFor("Foo2").ShouldEqual("B"); request.Substitutions.ValueFor("Foo3").ShouldEqual("C"); }
public void build_request_with_options() { var graph = new TemplateGraph(); var templateSet = new ProjectTemplate { Name = "Foo", Template = "FooProj", Alterations = new List <string> { "Foo1", "Foo2" } }; graph.AddCategory("new").Templates.Add(templateSet); templateSet.Options.Add(new Option { Name = "FooOpt1", Alterations = new List <string> { "C", "D" } }); templateSet.Options.Add(new Option { Name = "FooOpt2", Alterations = new List <string> { "E", "F" } }); templateSet.Options.Add(new Option { Name = "FooOpt3", Alterations = new List <string> { "G", "H" } }); var choices = new TemplateChoices { Category = "new", ProjectType = "Foo", ProjectName = "MyFoo", Options = new[] { "FooOpt1", "FooOpt3" } }; ProjectRequest request = graph.BuildProjectRequest(choices); request.Alterations.ShouldHaveTheSameElementsAs("Foo1", "Foo2", "C", "D", "G", "H"); }
public void build_request_with_default_value_for_a_selection() { var graph = new TemplateGraph(); var projectTemplate = new ProjectTemplate { Name = "Foo", Template = "FooProj", Alterations = new List <string> { "Foo1", "Foo2" }, DotNetVersion = DotNetVersion.V45 }; graph.AddCategory("new").Templates.Add(projectTemplate); projectTemplate.Selections.Add(new OptionSelection { Name = "FooSelection", Options = new List <Option> { new Option { Name = "FooOpt1", Alterations = new List <string> { "C", "D" } }, new Option { Name = "FooOpt2", Alterations = new List <string> { "E", "F" } } } }); var choices = new TemplateChoices { Category = "new", ProjectType = "Foo", ProjectName = "MyFoo" }; ProjectRequest request = graph.BuildProjectRequest(choices); request.Version.ShouldEqual(DotNetVersion.V45); request.Alterations.ShouldHaveTheSameElementsAs("Foo1", "Foo2", "C", "D"); }
public void build_request_with_named_value_for_a_selection() { var graph = new TemplateGraph(); var templateSet = new ProjectTemplate { Name = "Foo", Template = "FooProj", Alterations = new List <string> { "Foo1", "Foo2" } }; graph.AddCategory("new").Templates.Add(templateSet); templateSet.Selections.Add(new OptionSelection { Name = "FooSelection", Options = new List <Option> { new Option { Name = "FooOpt1", Alterations = new List <string> { "C", "D" } }, new Option { Name = "FooOpt2", Alterations = new List <string> { "E", "F" } } } }); var choices = new TemplateChoices { Category = "new", ProjectType = "Foo", ProjectName = "MyFoo" }; choices.Selections["FooSelection"] = "fooopt2"; ProjectRequest request = graph.BuildProjectRequest(choices); request.Alterations.ShouldHaveTheSameElementsAs("Foo1", "Foo2", "E", "F"); }
public void build_request_with_matching_template_and_options() { var graph = new TemplateGraph(); graph.AddCategory("new").Templates.Add(new ProjectTemplate { Name = "Foo", Template = "FooProj", Alterations = new List <string> { "Foo1", "Foo2" } }); var choices = new TemplateChoices { Category = "new", ProjectType = "Foo", ProjectName = "MyFoo" }; ProjectRequest request = graph.BuildProjectRequest(choices); request.Name.ShouldEqual(choices.ProjectName); request.Template.ShouldEqual("FooProj"); request.Alterations.ShouldHaveTheSameElementsAs("Foo1", "Foo2"); }