public void SetUp() { theTemplates = TemplateLibrary.BuildClean("validation"); theTemplates.StartTemplate(TemplateType.Solution, "Simple"); theTemplates.StartTemplate(TemplateType.Solution, "Complex"); theTemplates.StartTemplate(TemplateType.Project, "MvcApp"); theTemplates.StartTemplate(TemplateType.Project, "MvcBottle"); theTemplates.StartTemplate(TemplateType.Alteration, "Assets"); theTemplates.StartTemplate(TemplateType.Alteration, "HtmlConventions"); }
public void can_read_a_template_with_no_description() { var library = TemplateLibrary.BuildClean("no-description"); library.StartTemplate(TemplateType.Solution, "simple"); var template = library.Find(TemplateType.Solution, "simple"); template.Description.ShouldBeNull(); template.Name.ShouldEqual("simple"); template.Type.ShouldEqual(TemplateType.Solution); }
public void can_read_alteration_templates() { var library = TemplateLibrary.BuildClean("alterations"); library.StartTemplate(TemplateType.Alteration, "alter1"); library.StartTemplate(TemplateType.Alteration, "alter2"); library.StartTemplate(TemplateType.Alteration, "alter3"); library.All().Where(x => x.Type == TemplateType.Alteration) .Select(x => x.Name) .ShouldHaveTheSameElementsAs("alter1", "alter2", "alter3"); }
public void can_read_project_templates() { var library = TemplateLibrary.BuildClean("projects"); library.StartTemplate(TemplateType.Project, "proj1"); library.StartTemplate(TemplateType.Project, "proj2"); library.StartTemplate(TemplateType.Project, "proj3"); library.All().Where(x => x.Type == TemplateType.Project) .Select(x => x.Name) .ShouldHaveTheSameElementsAs("proj1", "proj2", "proj3"); }
public void generate_a_simple_template() { // SAMPLE: generating-with-templates var library = new TemplateLibrary("path to your templates"); var builder = new TemplatePlanBuilder(library); var request = buildTemplateRequest(); // Build a TemplatePlan var plan = builder.BuildPlan(request); plan.Execute(); // ENDSAMPLE }
public void SetUp() { library = new TemplateLibrary( ".".ToFullPath().ParentDirectory().ParentDirectory().ParentDirectory().AppendPath("templates")); theRequest = new TemplateRequest { RootDirectory = "integrated", SolutionName = "MySolution" }; new FileSystem().DeleteDirectory("integrated"); }
public void can_read_a_template_with_descriptions() { var library = TemplateLibrary.BuildClean("with-description"); var builder = library.StartTemplate(TemplateType.Solution, "described"); builder.WriteDescription("some description"); var template = library.Find(TemplateType.Solution, "described"); template.Description.ShouldEqual("some description"); template.Name.ShouldEqual("described"); template.Type.ShouldEqual(TemplateType.Solution); }
public void find_with_mixed() { var library = TemplateLibrary.BuildClean("mixed"); library.StartTemplate(TemplateType.Alteration, "first").WriteDescription("the alteration"); library.StartTemplate(TemplateType.Project, "first").WriteDescription("the solutionProject"); library.StartTemplate(TemplateType.Solution, "first").WriteDescription("the solution"); library.StartTemplate(TemplateType.Alteration, "alter2"); library.StartTemplate(TemplateType.Alteration, "alter3"); library.Find(TemplateType.Alteration, "first").Description.ShouldEqual("the alteration"); library.Find(TemplateType.Project, "first").Description.ShouldEqual("the solutionProject"); library.Find(TemplateType.Solution, "first").Description.ShouldEqual("the solution"); }
public EntityFactory(TemplateLibrary templateLibrary) { _templateLibrary = templateLibrary; }
static void Main(string[] args) { const string folder = "./data/templates"; var library = new TemplateLibrary(TemplateLoader.Load(folder)); var factory = new EntityFactory(library); var viper = factory.Create("TEST", library.Get("ship:small:viper")); var powerplant = viper.Hull.GetModule <PowerplantModule>(EntitySubcategory.ModulePowerplant); var engine = viper.Hull.GetModule <EngineModule>(EntitySubcategory.ModuleEngine); var shield = viper.Hull.GetModule <ShieldModule>(EntitySubcategory.ModuleShield); var messages = new Dictionary <int, Message> { { 1, new Message( viper.Id.ToString(), engine.Id.ToString(), "setPowerLevel", JToken.FromObject(100) ) }, { 2, new Message( viper.Id.ToString(), engine.Id.ToString(), "setThrottle", JToken.FromObject(10) ) }, { 3, new Message( viper.Id.ToString(), null, "applyDamage", JToken.FromObject(new Damage(DamageType.Kinetic, 40, new Vector3(0, 0, 50))) ) }, { 4, new Message( viper.Id.ToString(), shield.Id.ToString(), "setPowerLevel", JToken.FromObject(100) ) }, { 5, new Message( viper.Id.ToString(), engine.Id.ToString(), "setThrottle", JToken.FromObject(0) ) }, { 6, new Message( viper.Id.ToString(), powerplant.Id.ToString(), "setPowerLevel", JToken.FromObject(50) ) }, { 7, new Message( viper.Id.ToString(), null, "applyDamage", JToken.FromObject(new Damage(DamageType.Kinetic, 40, new Vector3(0, 0, 50))) ) }, { 8, new Message( viper.Id.ToString(), powerplant.Id.ToString(), "setPowerLevel", JToken.FromObject(75) ) }, { 9, new Message( viper.Id.ToString(), null, "applyDamage", JToken.FromObject(new Damage(DamageType.Thermal, 100)) ) } }; var deltaT = TimeSpan.FromSeconds(1); for (var i = 0; i < 11; i++) { Console.WriteLine($"--- UPDATE {i} ---"); if (messages.ContainsKey(i)) { Console.WriteLine(messages[i]); viper.HandleMessage(messages[i]); } viper.Update(deltaT); Console.WriteLine(viper.Body); Console.WriteLine(viper.Hull); Console.WriteLine(viper.Powergrid); Console.WriteLine(powerplant); Console.WriteLine(engine); Console.WriteLine(shield); Console.WriteLine(); } }