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