示例#1
0
        public void use_the_solution_template_if_it_exists()
        {
            new FileSystem().WriteStringToFile(theLocation.SrcFolder().AppendPath("templates", "view.spark"), "The solution template!");

            FileTemplate.Find(theLocation, "view.spark")
            .RawText.ShouldContain("The solution template!");
        }
示例#2
0
        public void choose_the_project_template_if_it_exists_and_takes_precedence_over_the_solution()
        {
            new FileSystem().WriteStringToFile(theLocation.SrcFolder().AppendPath("templates", "view.spark"), "The solution template!");


            new FileSystem().WriteStringToFile(theLocation.ProjectFolder().AppendPath("view.spark"), "The project template!");

            FileTemplate.Find(theLocation, "view.spark")
            .RawText.ShouldContain("The project template!");
        }
示例#3
0
        public static void BuildView(ViewInput input)
        {
            Location location = ProjectFinder.DetermineLocation(Environment.CurrentDirectory);
            var      template = FileTemplate.Find(location, input.TemplateFlag);

            ViewModelBuilder.BuildCodeFile(input, location);

            var modelName = location.Namespace + "." + input.Name;


            var path = ViewBuilder.Write(template, location, modelName);

            var viewPath = path.PathRelativeTo(location.ProjectFolder()).Replace('\\', '/');

            location.Project.Add(new Content(viewPath));
            location.Project.Save();

            if (input.OpenFlag)
            {
                EditorLauncher.LaunchFile(path);
            }
        }
示例#4
0
        public void fall_all_the_way_through_to_the_embedded_resource_if_nothing_else_exists()
        {
            var template = FileTemplate.Find(theLocation, "view.spark");

            template.RawText.ShouldEqual(FileTemplate.Embedded("view.spark").RawText);
        }