Ejemplo n.º 1
0
 public void NUnitPath_should_be_based_on_NUnitBinPath()
 {
     var envionrment = new ExecutionEnvironmentStub();
     envionrment.IsMonoHandler = () => false;
     var nunit = new NUnitTask(envionrment);
     var binPath = new Path("NUnit") + "bin";
     nunit.NUnitBinPath = binPath;
     nunit.NUnitPath.ShouldEqual(binPath + "nunit-console.exe");
 }
Ejemplo n.º 2
0
 public void CopyTo(Path destination)
 {
     fileSystem.EnsureDirectory(destination);
     foreach(var file in Items)
     {
         var target = destination + file.GetFileName();
         if(fileSystem.FileExists(target) || !fileSystem.FileExists(file))
             return;
         fileSystem.CopyFile(file, target, true);
     }
 }
Ejemplo n.º 3
0
        public void Should_create_target_directory_if_not_present()
        {
            var fileSystem = new FileSystemStub();
            var environment = new ExecutionEnvironmentStub();

            var compiler = new CSharpCompilerTask(fileSystem, environment);
            var outDir = new Path("Build").Combine("Debug");
            compiler.Output = outDir.Combine("Pencil.Build.dll");
            Path createdDirectory = Path.Empty;

            fileSystem.DirectoryExistsHandler = x => false;
            fileSystem.CreateDirectoryHandler = x => createdDirectory = new Path(x);
            compiler.Execute();

            outDir.ShouldEqual(createdDirectory);
        }
Ejemplo n.º 4
0
        public void Should_copy_referenced_assemblies()
        {
            var fileSystem = new FileSystemStub();
            var environment = new ExecutionEnvironmentStub();

            var compiler = new CSharpCompilerTask(fileSystem, environment);
            var outDir = new Path("Build");
            compiler.Output = outDir.Combine("Bar.dll");
            compiler.References.Add(new Path("Foo.dll"));

            fileSystem.DirectoryExistsHandler = x => true;
            fileSystem.FileExistsHandler = x => x.Equals(new Path("Foo.dll"));
            bool copied = false;
            fileSystem.CopyFileHandler = (from, to, overwrite) =>
            {
                Assert.AreEqual(new Path("Foo.dll"), from);
                Assert.AreEqual(outDir + "Foo.dll", to);
                copied = true;
            };
            compiler.Execute();

            Assert.IsTrue(copied, "Referenced assembly not copied.");
        }
Ejemplo n.º 5
0
 public bool ChangedAfter(Path path)
 {
     return ChangedAfter(fileSystem.GetLastWriteTime(path));
 }
Ejemplo n.º 6
0
 public FileSet Add(Path path)
 {
     items.Add(path);
     return this;
 }
Ejemplo n.º 7
0
 public System.IO.Stream OpenWrite(Path path)
 {
     return System.IO.Stream.Null;
 }
Ejemplo n.º 8
0
 public DateTime GetLastWriteTime(Path path)
 {
     return GetLastWriteTimeHandler(path);
 }
Ejemplo n.º 9
0
 public IEnumerable<Path> GetFilesRecursive(Path root, string pattern)
 {
     return GetFilesRecursiveHandler(root, pattern);
 }
Ejemplo n.º 10
0
 public bool FileExists(Path path)
 {
     return FileExistsHandler(path);
 }
Ejemplo n.º 11
0
 public void DeleteFile(Path path)
 {
     DeleteFileHandler(path);
 }
Ejemplo n.º 12
0
 public void CopyFile(Path from, Path to, bool overwrite)
 {
     CopyFileHandler(from, to, overwrite);
 }