コード例 #1
0
        public void TestNumberingStrategy()
        {
            var row = TestContext.DataRow;

            // extract csv data
            string name      = row["Name"].ToString();
            string extension = row["Extension"].ToString();
            int    position  = Int32.Parse(row["Position"].ToString());
            bool   fromLeft  = row["FromLeft"].ToString() == "Y";
            bool   insert    = row["Insert"].ToString() == "Y";
            string text      = row["Text"].ToString();
            string expected  = row["Expected"].ToString();
            string behaviour = row["Behaviour"].ToString();

            NameExtensionHelper helper;

            switch (behaviour)
            {
            case "N":
                helper = NameExtensionHelper.CreateNameExtensionHelper(NameExtensionBehaviour.NameOnly);
                break;

            case "X":
                helper = NameExtensionHelper.CreateNameExtensionHelper(NameExtensionBehaviour.ExtensionOnly);
                break;

            default:
                helper = NameExtensionHelper.CreateNameExtensionHelper(NameExtensionBehaviour.BothNameExtension);
                break;
            }

            InsertTextStrategy strategy = new InsertTextStrategy(position, text, fromLeft, insert);
            IFileMetaData      file     = CreateFileMetaData(name + "." + extension);

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

            Assert.AreEqual(expected, result);
        }
コード例 #2
0
 public InsertTextViewModel()
 {
     _position   = "0";
     _strategy   = new InsertTextStrategy(0, "", true, true);
     DisplayName = "Insert / Overwrite";
 }