当前位置: 首页>>代码示例>>C#>>正文


C# Workspace.LoadFiles方法代码示例

本文整理汇总了C#中Workspace.LoadFiles方法的典型用法代码示例。如果您正苦于以下问题:C# Workspace.LoadFiles方法的具体用法?C# Workspace.LoadFiles怎么用?C# Workspace.LoadFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Workspace的用法示例。


在下文中一共展示了Workspace.LoadFiles方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShouldMatchExactlyFileName

 public void ShouldMatchExactlyFileName()
 {
     var workspace = new Workspace();
     workspace.BasePath = Path.Combine(basePath, "ShouldNotAllowMultipleCrakefiles");
     Directory.CreateDirectory(workspace.BasePath);
     File.Create(Path.Combine(workspace.BasePath, "crakefile"));
     File.Create(Path.Combine(workspace.BasePath, "cCrakefile"));
     workspace.LoadFiles();
     Assert.AreEqual(1, workspace.Files.Count);
 }
开发者ID:felipecvo,项目名称:crake,代码行数:10,代码来源:WorkspaceTest.cs

示例2: ShouldLoadDefaultCrakefile

 public void ShouldLoadDefaultCrakefile()
 {
     var workspace = new Workspace();
     workspace.BasePath = Path.Combine(basePath, "ShouldLoadDefaultCrakefile");
     Directory.CreateDirectory(workspace.BasePath);
     File.Create(Path.Combine(workspace.BasePath, "crakefile"));
     workspace.LoadFiles();
     Assert.AreEqual(1, workspace.Files.Count);
     Assert.AreEqual(Path.Combine(workspace.BasePath, "crakefile"), workspace.Files[0]);
 }
开发者ID:felipecvo,项目名称:crake,代码行数:10,代码来源:WorkspaceTest.cs

示例3: ShouldLoadFilesFromTasksSubDir

 public void ShouldLoadFilesFromTasksSubDir()
 {
     var workspace = new Workspace();
     workspace.BasePath = Path.Combine(basePath, "ShouldLoadFilesFromTasksDir");
     Directory.CreateDirectory(workspace.BasePath);
     Directory.CreateDirectory(workspace.TasksDir);
     Directory.CreateDirectory(Path.Combine(workspace.TasksDir, "subdir"));
     File.Create(Path.Combine(workspace.TasksDir, "task1.crake"));
     File.Create(Path.Combine(Path.Combine(workspace.TasksDir, "subdir"), "task2.crake"));
     workspace.LoadFiles();
     Assert.AreEqual(2, workspace.Files.Count);
     Assert.AreEqual(Path.Combine(workspace.TasksDir, "task1.crake"), workspace.Files[0]);
     Assert.AreEqual(Path.Combine(Path.Combine(workspace.TasksDir, "subdir"),"task2.crake"), workspace.Files[1]);
 }
开发者ID:felipecvo,项目名称:crake,代码行数:14,代码来源:WorkspaceTest.cs

示例4: ShouldCreateTasks

        public void ShouldCreateTasks()
        {
            Task.Tasks.Clear();
            var workspace = new Workspace();
            workspace.BasePath = Path.Combine(basePath, "ShouldCreateTasks");
            Directory.CreateDirectory(workspace.TasksDir);
            var f = File.Create(Path.Combine(workspace.TasksDir, "task1.crake"));
            var buf = ASCIIEncoding.ASCII.GetBytes("namespace :name1 do\ntask :todo1 do\nint i;\nSay();\nSay();\nend\nend\n public void Say() {\nConsole.WriteLine(\"oi\");\n}");
            f.Write(buf, 0, buf.Length);
            f.Close();
            workspace.LoadFiles();
            workspace.Parse();
            workspace.Compile();

            var linker = new Linker(workspace);

            Assert.AreEqual(0, Task.Tasks.Count);
            linker.CreateTasks();
            Assert.AreEqual(1, Task.Tasks.Count);
            Task.Tasks["name1:todo1"].Run();
        }
开发者ID:felipecvo,项目名称:crake,代码行数:21,代码来源:LinkerTest.cs

示例5: ShouldCompileNLines

        public void ShouldCompileNLines()
        {
            var workspace = new Workspace();
            workspace.BasePath = Path.Combine(basePath, "Compile");
            Directory.CreateDirectory(workspace.TasksDir);
            var f = File.Create(Path.Combine(workspace.TasksDir, "task1.crake"));
            var buf = ASCIIEncoding.ASCII.GetBytes("namespace :name1 do\ntask :todo1 do\nint i;\nSay();\nSay();\nend\nend\n public void Say() {\nConsole.WriteLine(\"oi\");\n}");
            f.Write(buf, 0, buf.Length);
            f.Close();
            workspace.LoadFiles();
            workspace.Parse();
            workspace.Compile();

            var typeName = string.Format("Crake.Runtime.{0}", workspace.ParsedFiles[0].UniqueName);
            Type type = null;

            var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
            foreach (var asm in loadedAssemblies) {
                type = asm.GetType(typeName);
                if (type != null) break;
            }

            Assert.IsNotNull(Assembly.GetAssembly(type));
        }
开发者ID:felipecvo,项目名称:crake,代码行数:24,代码来源:WorkspaceTest.cs

示例6: ShouldNotFailWhenDefaultCrakefileNotExists

 public void ShouldNotFailWhenDefaultCrakefileNotExists()
 {
     var workspace = new Workspace();
     workspace.BasePath = Path.Combine(basePath, "ShouldNotFailWhenDefaultCrakefileNotExists");
     Directory.CreateDirectory(workspace.BasePath);
     workspace.LoadFiles();
     Assert.AreEqual(0, workspace.Files.Count);
 }
开发者ID:felipecvo,项目名称:crake,代码行数:8,代码来源:WorkspaceTest.cs

示例7: ShouldNotAllowMultipleCrakefiles

        public void ShouldNotAllowMultipleCrakefiles()
        {
            var workspace = new Workspace();
            workspace.BasePath = Path.Combine(basePath, "ShouldNotAllowMultipleCrakefiles");
            Directory.CreateDirectory(workspace.BasePath);
            File.Create(Path.Combine(workspace.BasePath, "crakefile"));
            if (File.Exists(Path.Combine(workspace.BasePath, "Crakefile"))){
                Assert.Ignore("File System is not case sensitive.");
                return;
            }

            File.Create(Path.Combine(workspace.BasePath, "Crakefile"));
            workspace.LoadFiles();
        }
开发者ID:felipecvo,项目名称:crake,代码行数:14,代码来源:WorkspaceTest.cs

示例8: ShouldParse

 public void ShouldParse()
 {
     var workspace = new Workspace();
     workspace.BasePath = Path.Combine(basePath, "Parse");
     Directory.CreateDirectory(workspace.TasksDir);
     var f = File.Create(Path.Combine(workspace.TasksDir, "parse.crake"));
     var buf = ASCIIEncoding.ASCII.GetBytes("namespace :name1 do\ntask :todo1 do\nSay();\nend\nend\n public void Say() {\nConsole.WriteLine(\"oi\");\n}");
     f.Write(buf, 0, buf.Length);
     f.Close();
     workspace.LoadFiles();
     workspace.Parse();
     Assert.AreEqual(1, workspace.ParsedFiles.Count);
     var actual = workspace.ParsedFiles[0];
     Assert.AreEqual(1, actual.Tasks.Count);
     Assert.AreEqual("name1:todo1", actual.Tasks[0].Name);
     Assert.AreEqual(1, actual.HelperMethods.Count);
     Assert.AreEqual("Say", actual.HelperMethods[0].Name.ToString());
 }
开发者ID:felipecvo,项目名称:crake,代码行数:18,代码来源:WorkspaceTest.cs


注:本文中的Workspace.LoadFiles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。