Exemple #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");
 }
Exemple #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);
     }
 }
        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);
        }
        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.");
        }
Exemple #5
0
 public bool ChangedAfter(Path path)
 {
     return ChangedAfter(fileSystem.GetLastWriteTime(path));
 }
Exemple #6
0
 public FileSet Add(Path path)
 {
     items.Add(path);
     return this;
 }
Exemple #7
0
 public System.IO.Stream OpenWrite(Path path)
 {
     return System.IO.Stream.Null;
 }
Exemple #8
0
 public DateTime GetLastWriteTime(Path path)
 {
     return GetLastWriteTimeHandler(path);
 }
Exemple #9
0
 public IEnumerable<Path> GetFilesRecursive(Path root, string pattern)
 {
     return GetFilesRecursiveHandler(root, pattern);
 }
Exemple #10
0
 public bool FileExists(Path path)
 {
     return FileExistsHandler(path);
 }
Exemple #11
0
 public void DeleteFile(Path path)
 {
     DeleteFileHandler(path);
 }
Exemple #12
0
 public void CopyFile(Path from, Path to, bool overwrite)
 {
     CopyFileHandler(from, to, overwrite);
 }