public void Reflow_GetFilesInDirectory_Returns_All_Files_InDirectory() { var filesDirectory = @"..\..\..\GetFilesInDirSample01"; var reflowResult = _reflow.GetFilesInDirectory(filesDirectory).Result; var files = ParseUtils.ParseCollection <ReflowFile>(reflowResult); files.Should().NotBeNull(); files.Count.Should().Be(6); FileIsCorrect(files, 0, "ExampleDocxFile", "docx"); FileIsCorrect(files, 1, "ExampleExeFile", "exe"); FileIsCorrect(files, 2, "ExampleFileNoExtension", ""); FileIsCorrect(files, 3, "ExampleSvgFile", "svg"); FileIsCorrect(files, 4, "ExampleTextDocument", "txt"); FileIsCorrect(files, 5, "ExampleZipFile", "zip"); }
public void Reflow_RenameFiles_Should_Successfully_Rename_Files() { var filesLocation = @"..\..\..\RenameFilesSample\Files"; var tagJson = @"..\..\..\RenameFilesSample\AddTag.json"; var filesDirectory = _reflow.GetFilesInDirectory(filesLocation); var addTag = _reflow.AddTag(System.IO.File.ReadAllText(tagJson)); var files = _reflow.GetFiles(null).Result; var res = ParseUtils.ParseCollection <ReflowFile>(files); var settings = new ReflowRenameOptionSet() { CreateBackup = false, BackupFolder = "", FileExistsStrategy = FileExistsStrategy.Skip, FileExistsFolder = "" }; var rename = _reflow.RenameFiles(JsonConvert.SerializeObject(settings)).Result; }
public void Reflow_WorkflowTest_01() { var filesLocation = @"..\..\..\ComboSamples\01\Files"; var tagJson = @"..\..\..\ComboSamples\01\AddTag.json"; var updateJson = @"..\..\..\ComboSamples\01\UpdateTag.json"; var filesDirectory = _reflow.GetFilesInDirectory(filesLocation); var addTag = _reflow.AddTag(System.IO.File.ReadAllText(tagJson)); var update = _reflow.UpdateTagsData(System.IO.File.ReadAllText(updateJson)); var files = _reflow.GetFiles(null).Result; var res = ParseUtils.ParseCollection <ReflowFile>(files); res.Count.Should().Be(6); res[0].NewName.Should().Be("05"); res[1].NewName.Should().Be("10"); res[2].NewName.Should().Be("15"); res[3].NewName.Should().Be("20"); res[4].NewName.Should().Be("25"); res[5].NewName.Should().Be("30"); }
static void Main(string[] args) { string path = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\")); string fileDir = @"C:\Users\Hentov\Desktop\testcount"; AppDomain.CurrentDomain.SetData("DataDirectory", path); Console.WriteLine(path); ReflowController app = new ReflowController(); int testNumber = 1; Console.WriteLine($"[{testNumber++}] Get Dir()"); Console.WriteLine(app.GetDir(null).Result); Console.WriteLine($"{Environment.NewLine}[{testNumber++}] Get Files In Directory()"); Console.WriteLine(app.GetFilesInDirectory(fileDir).Result); Console.WriteLine($"{Environment.NewLine}[{testNumber++}] Get Files Count()"); Console.WriteLine(app.GetFilesCount(null).Result); Console.WriteLine($"{Environment.NewLine}[{testNumber++}] Get Options()"); Console.WriteLine(app.GetSettings(null).Result); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine($"{Environment.NewLine}[{testNumber++}] Get Tags()"); Console.WriteLine(app.GetTags(null).Result); Console.WriteLine($"{Environment.NewLine}[{testNumber++}] Get Progress()"); Console.WriteLine(app.GetProgress(null).Result); //var res = app.UpdateTagsStructure( // "[{\"Id\":1,\"TagType\":\"AutoIncrementTag\",\"Options\":[{\"Id\":1,\"TagType\":\"Has Leading Zero\",\"Type\":\"CheckBox\",\"Default\":true,\"props\":{\"name\":\"Has Leading Zero\",\"default\":true}},{\"Id\":2,\"TagType\":\"Start From\",\"Type\":\"NumericBox\",\"Default\":0,\"props\":{\"name\":\"Start From\",\"default\":0}},{\"Id\":3,\"TagType\":\"Skip\",\"Type\":\"NumericBox\",\"Default\":0,\"props\":{\"name\":\"Skip\",\"default\":0}}]}]"); var res2 = app.GetFiles(null).Result.ToString(); Console.WriteLine(res2); }