public void ChangeFileName_WithoutRule_ReturnName() { var file = new FileInfoBaseBuilder().SetName("Schedule (1).docx").Build(); var result = _fileNameManager.ChangeFileName(file, defaultsFolder); Assert.IsNotNull(result); Assert.AreEqual($"Schedule.docx", result); }
public void ChangeFileName_WithSerialNumber_ReturnNameWithSerialNumber2() { RuleElement rule = new RuleElement() { Template = @" ^.*\.(pptx)$", DestinationFolder = @"C:\Downloads\presentations", NameChangeRule = NameChangeRule.SerialNumber }; var file = new FileInfoBaseBuilder().SetName("Arrays and Collections.pptx").Build(); var result = _fileNameManager.ChangeFileName(file, defaultsFolder, rule); Assert.IsNotNull(result); Assert.AreEqual("2.Arrays and Collections.pptx", result); }
public void ChangeFileName_WithLastModifyDate_ReturnNameWithDate() { RuleElement rule = new RuleElement() { Template = @" ^.*\.(docx)$", DestinationFolder = @"C:\Downloads\documents", NameChangeRule = NameChangeRule.LastModifyDate }; var file = new FileInfoBaseBuilder().SetName("Ideas.docx").Build(); var result = _fileNameManager.ChangeFileName(file, defaultsFolder, rule); Assert.IsNotNull(result); Assert.AreEqual($"Ideas {DateTime.Now.ToString("D", CultureInfo.InvariantCulture)}.docx", result); }
public void ChangeFileName_WithSerialNumber_ReturnNameWithSerialNumber1() { RuleElement rule = new RuleElement() { Template = @" ^.*\.(docx)$", DestinationFolder = @"C:\Downloads\documents", NameChangeRule = NameChangeRule.SerialNumber }; var file = new FileInfoBaseBuilder().SetName("Ideas.docx").Build(); var result = _fileNameManager.ChangeFileName(file, defaultsFolder, rule); Assert.IsNotNull(result); Assert.AreEqual("1.Ideas.docx", result); }