Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }