Example #1
0
        public void SuffixTest()
        {
            var source = "source";
            var suffix = "_TEST";

            var renameable = GetRenameable(source);

            var optionsVm = new OptionsVm {
                Suffix = suffix
            };
            var action = optionsVm.Rename;

            action(renameable);
            renameable.Destination.Should().Be(source + suffix);
        }
Example #2
0
        public void PrefixTest()
        {
            var source = "source";
            var prefix = "TEST_";

            var renameable = GetRenameable(source);

            var optionsVm = new OptionsVm {
                Prefix = prefix
            };
            var action = optionsVm.Rename;

            action(renameable);
            renameable.Destination.Should().Be(prefix + source);
        }
Example #3
0
        public void EndWithTest()
        {
            var source = "sourceXXX";
            var result = "source";
            var find   = "XXX";

            var renameable = GetRenameable(source);

            var optionsVm = new OptionsVm {
                Find = find
            };

            optionsVm.OptionCheckedCmd.Execute(nameof(RenameOption.EndWith));
            var action = optionsVm.Rename;

            action(renameable);

            renameable.Destination.Should().Be(result);
        }
Example #4
0
        public void CaseSensitiveTest()
        {
            var source = "souXxXrce";
            var result = "source";
            var find   = "xxx";

            var renameable = GetRenameable(source);

            var optionsVm = new OptionsVm {
                Find = find, IsCaseSensitive = true
            };

            optionsVm.OptionCheckedCmd.Execute(nameof(RenameOption.Contains));
            var action = optionsVm.Rename;

            action(renameable);

            renameable.Destination.Should().Be(result);
        }
Example #5
0
        public void RegexTest()
        {
            var source = "sou1245rce";
            var result = "source";
            var find   = @"\d{4}";

            var renameable = GetRenameable(source);

            var optionsVm = new OptionsVm {
                Find = find
            };

            optionsVm.OptionCheckedCmd.Execute(nameof(RenameOption.Regex));
            var action = optionsVm.Rename;

            action(renameable);

            renameable.Destination.Should().Be(result);
        }
Example #6
0
        public void MatchesWholeTest()
        {
            var source = "source";
            var result = "XXX";
            var find   = "source";

            var renameable = GetRenameable(source);

            var optionsVm = new OptionsVm {
                Find = find, ReplaceValue = result
            };

            optionsVm.OptionCheckedCmd.Execute(nameof(RenameOption.MatchesWhole));
            var action = optionsVm.Rename;

            action(renameable);

            renameable.Destination.Should().Be(result);
        }
Example #7
0
        public void AllInTest()
        {
            var source = "souXxXrce";
            var result = "TEST_source_TEST";
            var find   = "xxx";
            var prefix = "TEST_";
            var suffix = "_TEST";

            var renameable = GetRenameable(source);

            var optionsVm = new OptionsVm {
                Find = find, IsCaseSensitive = true, Prefix = prefix, Suffix = suffix
            };

            optionsVm.OptionCheckedCmd.Execute(nameof(RenameOption.Contains));
            var action = optionsVm.Rename;

            action(renameable);

            renameable.Destination.Should().Be(result);
        }