public void FileConnectorGetFiles2Test() { FileSystemConnector fileSystemConnector = new FileSystemConnector(@".\Resources", ""); var files = fileSystemConnector.GetFiles("Templates"); Assert.IsTrue(files.Count > 0); var files2 = fileSystemConnector.GetFiles(""); Assert.IsTrue(files2.Count > 0); }
public void FileConnectorForwardslashSupportTest() { // Path with forwardslash separator var filename = "separator.png"; var containerWithForwardSlash = @"Resources/Templates/newfolder"; // Constructor replaces folder delimiter FileSystemConnector fileSystemConnector = new FileSystemConnector(".", containerWithForwardSlash); Assert.AreEqual(@"Resources\Templates\newfolder", fileSystemConnector.GetContainer()); // Save a file long byteCount = 0; using (var fileStream = System.IO.File.OpenRead(@".\resources\office365.png")) { byteCount = fileStream.Length; fileSystemConnector.SaveFileStream(filename, containerWithForwardSlash, fileStream); } // List files var files = fileSystemConnector.GetFiles(containerWithForwardSlash); Assert.IsTrue(files.Contains(filename)); // Read the file using (var bytes = fileSystemConnector.GetFileStream(filename, containerWithForwardSlash)) { Assert.IsTrue(byteCount == bytes.Length); } // Delete the file fileSystemConnector.DeleteFile(filename, containerWithForwardSlash); // Folder will be deleted in cleanup }