public void AddOutputAddsMetalsharpFile() { var file = new MetalsharpFile("fileText", "filePath"); var project = new MetalsharpProject().AddOutput(file); Assert.True(project.OutputFiles.Contains(file)); }
public void ExtensionAssignsCorrectValue(string path, string extensionToAssign) { var file = new MetalsharpFile("text", path, new Dictionary <string, object>()); file.Extension = extensionToAssign; Assert.True(file.FilePath == Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path) + extensionToAssign)); }
public void NameAssignsCorrectValue(string path, string nameToAssign) { var file = new MetalsharpFile("text", path, new Dictionary <string, object>()); file.Name = nameToAssign; Assert.True(file.FilePath == Path.Combine(Path.GetDirectoryName(path), nameToAssign + Path.GetExtension(path))); }
public void DirectoryAssignsCorrectValue(string path, string directoryToAssign) { var file = new MetalsharpFile("text", path, new Dictionary <string, object>()); file.Directory = directoryToAssign; Assert.True(file.FilePath == Path.Combine(directoryToAssign, Path.GetFileName(file.FilePath))); }
public void TextWorks() { var file = new MetalsharpFile("text", "path", new Dictionary <string, object>()); Assert.True(file.Text == "text"); file.Text = "newtext"; Assert.True(file.Text == "newtext"); }
public void MetadataWorks() { var file = new MetalsharpFile("text", "path", new Dictionary <string, object> { ["test1"] = "value" }); Assert.True(file.Metadata["test1"].ToString() == "value"); }
public void FilePathWorks() { var file = new MetalsharpFile("text", "path", new Dictionary <string, object>()); Assert.True(file.FilePath == "path"); file.FilePath = "newpath"; Assert.True(file.FilePath == "newpath"); }
public void RemoveOutputByPredicateSelectsFilesCorrectly() { var file = new MetalsharpFile("text", "File.txt"); var project = new MetalsharpProject() .AddOutput(file) .RemoveOutput(f => f.Text == "text"); Assert.False(project.OutputFiles.Contains(file)); }
public void RemoveOutputByPathRemovesFilesCorrectly() { var file = new MetalsharpFile("text", "File.txt"); var project = new MetalsharpProject() .AddOutput(file) .RemoveOutput(file.FilePath); Assert.False(project.OutputFiles.Contains(file)); }
public void MoveOutputByPredicateSelectsFilesCorrectly() { var file = new MetalsharpFile("text", "dir1\\File.txt"); var project = new MetalsharpProject() .AddOutput(file) .MoveOutput(f => f.Text == "text", "dir2"); Assert.True(project.OutputFiles[0].Directory == "dir2"); }
public void MoveInputByPathMovesFilesCorrectly() { var file = new MetalsharpFile("text", "dir1\\File.txt"); var project = new MetalsharpProject() .AddInput(file) .MoveInput("dir1", "dir2"); Assert.True(project.InputFiles[0].Directory == "dir2"); }
public void RemoveFilesByPredicateEquivalentToInputAndOutput() { var file = new MetalsharpFile("text", "File.txt"); var project = new MetalsharpProject() .AddInput(file) .AddOutput(file) .RemoveFiles(f => f.Text == "text"); Assert.False(project.InputFiles.Contains(file)); Assert.False(project.OutputFiles.Contains(file)); }
public void MoveFilesByPredicateEquivalentToInputAndOutput() { var file = new MetalsharpFile("text", "dir1\\File.txt"); var project = new MetalsharpProject() .AddInput(file) .AddOutput(file) .MoveFiles(f => f.Text == "text", "dir2"); Assert.True(project.InputFiles[0].Directory == "dir2"); Assert.True(project.OutputFiles[0].Directory == "dir2"); }
public void NameReturnsCorrectResult(string path) { var file = new MetalsharpFile("text", path, new Dictionary <string, object>()); Assert.True(file.Name == Path.GetFileNameWithoutExtension(path)); }
public void IsDescendantOfReturnsCorrectResult(string path, string ancestorDirectory, bool expectedResult) { var file = new MetalsharpFile("text", path, new Dictionary <string, object>()); Assert.True(file.IsDescendantOf(ancestorDirectory) == expectedResult); }
public void DirectoryReturnsCorrectResult(string path) { var file = new MetalsharpFile("text", path, new Dictionary <string, object>()); Assert.True(file.Directory == Path.GetDirectoryName(path)); }
public void IsChildOfReturnsCorrectResult(string path, string parentDirectory, bool expectedResult) { var file = new MetalsharpFile("text", path, new Dictionary <string, object>()); Assert.True(file.IsChildOf(parentDirectory) == expectedResult); }