Пример #1
0
        public void TestNumberingStrategySequential()
        {
            NumberingStrategy strategy = new NumberingStrategy(NumberingFormat.NoZeros, NumberingTextFormat.TextNumber, "5", "Test");
            var    helper = NameExtensionHelper.CreateNameExtensionHelper(NameExtensionBehaviour.NameOnly);
            var    file   = CreateFileMetaData("test.txt");
            string result = strategy.RenameFile(file, 4, helper);

            Assert.AreEqual("Test9.txt", result);
        }
Пример #2
0
        public void TestNumberingStrategy()
        {
            var row = TestContext.DataRow;

            // extract csv data
            string              name       = row["Name"].ToString();
            string              extension  = row["Extension"].ToString();
            int                 number     = Int32.Parse(row["Number"].ToString());
            NumberingFormat     format     = (NumberingFormat)Int32.Parse(row["Format"].ToString());
            NumberingTextFormat textformat = (NumberingTextFormat)Int32.Parse(row["TextFormat"].ToString());
            string              text       = row["Text"].ToString();
            string              expected   = row["Expected"].ToString();

            NumberingStrategy   strategy = new NumberingStrategy(format, textformat, "0", text);
            NameExtensionHelper helper   = NameExtensionHelper.CreateNameExtensionHelper(NameExtensionBehaviour.NameOnly);
            IFileMetaData       file     = CreateFileMetaData(name + "." + extension);

            string result = strategy.RenameFile(file, number, helper);

            Assert.AreEqual(expected, result);
        }
 public NumberingViewModel()
 {
     _strategy   = new NumberingStrategy(NumberingFormat.NoZeros, NumberingTextFormat.OldNameTextNumber, "1", "");
     DisplayName = "Numbering";
 }