Пример #1
0
        public void TestFileName()
        {
            FileRenameManager                  manager = new FileRenameManager();
            List <FileRenameValueError>        errors  = new List <FileRenameValueError>();
            FileRenameValueReferenceCollection res     = manager.ParseString("{FileName}", errors);

            Assert.AreEqual(1, res.Count);
            Assert.AreEqual("FileName", res[0].FileRenameValue.Name);
        }
Пример #2
0
        public void TestFailedWhenEmptyKeyword()
        {
            FileRenameManager                  manager = new FileRenameManager();
            List <FileRenameValueError>        errors  = new List <FileRenameValueError>();
            FileRenameValueReferenceCollection res     = manager.ParseString("{}", errors);

            Assert.AreEqual(0, res.Count);
            Assert.AreEqual(1, errors.Count);
            Assert.AreEqual(string.Empty, errors[0].Name);
        }
Пример #3
0
        public void TestNoKeyword()
        {
            FileRenameManager                  manager = new FileRenameManager();
            List <FileRenameValueError>        errors  = new List <FileRenameValueError>();
            FileRenameValueReferenceCollection res     = manager.ParseString("Hello World", errors);

            Assert.AreEqual(1, res.Count);
            Assert.AreEqual(0, errors.Count);
            Assert.AreEqual("CustomText", res[0].FileRenameValue.Name);
            Assert.AreEqual("Hello World", res[0].ValueCore);
        }
Пример #4
0
        public void TestTemplate()
        {
            FileRenameManager manager = new FileRenameManager();

            manager.Template = "{CustomText} - {Index} of {Count}";
            Assert.AreEqual(5, manager.TemplateValues.Count);
            Assert.AreEqual("CustomText", manager.TemplateValues[0].FileRenameValue.Name);
            Assert.AreEqual("CustomText", manager.TemplateValues[1].FileRenameValue.Name);
            Assert.AreEqual(" - ", manager.TemplateValues[1].ValueCore);
            Assert.AreEqual("Index", manager.TemplateValues[2].FileRenameValue.Name);
            Assert.AreEqual("CustomText", manager.TemplateValues[3].FileRenameValue.Name);
            Assert.AreEqual(" of ", manager.TemplateValues[3].ValueCore);
            Assert.AreEqual("Count", manager.TemplateValues[4].FileRenameValue.Name);
        }
Пример #5
0
        public void TestCustomNameXofY()
        {
            FileRenameManager                  manager = new FileRenameManager();
            List <FileRenameValueError>        errors  = new List <FileRenameValueError>();
            FileRenameValueReferenceCollection res     = manager.ParseString("{CustomText} - {Index} of {Count}", errors);

            Assert.AreEqual(5, res.Count);
            Assert.AreEqual("CustomText", res[0].FileRenameValue.Name);
            Assert.AreEqual("CustomText", res[1].FileRenameValue.Name);
            Assert.AreEqual(" - ", res[1].ValueCore);
            Assert.AreEqual("Index", res[2].FileRenameValue.Name);
            Assert.AreEqual("CustomText", res[3].FileRenameValue.Name);
            Assert.AreEqual(" of ", res[3].ValueCore);
            Assert.AreEqual("Count", res[4].FileRenameValue.Name);
        }
Пример #6
0
        public void TestGetFileName()
        {
            FileRenameManager manager = new FileRenameManager();

            manager.Template = "{FileName} - {Width}x{Height} - {Index} of {Count}.{Extension}";
            DmFile file = new DmFile();

            file.FileName = "MyPhoto.JPG";
            file.Width    = 2000;
            file.Height   = 1000;
            List <DmFile> list = new List <DmFile>();

            list.Add(new DmFile());
            list.Add(new DmFile());
            list.Add(new DmFile());
            list.Add(file);
            list.Add(new DmFile());
            string res = manager.GetFileName(list, file);

            Assert.AreEqual(0, manager.Errors.Count);
            Assert.AreEqual("MyPhoto - 2000x1000 - 4 of 5.JPG", res);
        }
 public override void ApplyParams(FileRenameManager manager)
 {
     base.ApplyParams(manager);
     Extension = manager.Extension;
 }
 public virtual void ApplyParams(FileRenameManager manager)
 {
 }