static void TestMethod_Asserts_IsStringArrayEq()
 {
     TestUtil.IsStringArrayEq(null, null);
     TestUtil.IsStringArrayEq(null, new string[] { });
     TestUtil.IsStringArrayEq("", new string[] { "" });
     TestUtil.IsStringArrayEq("|", new string[] { "", "" });
     TestUtil.IsStringArrayEq("||", new string[] { "", "", "" });
     TestUtil.IsStringArrayEq("aa|bb|cc", new string[] { "aa", "bb", "cc" });
 }
        static void TestMethod_SplitByString()
        {
            TestUtil.IsStringArrayEq("", Utils.SplitByString("", "delim"));
            TestUtil.IsStringArrayEq("|", Utils.SplitByString("delim", "delim"));
            TestUtil.IsStringArrayEq("||", Utils.SplitByString("delimdelim", "delim"));
            TestUtil.IsStringArrayEq("a||b", Utils.SplitByString("adelimdelimb", "delim"));
            TestUtil.IsStringArrayEq("a|bb|c", Utils.SplitByString("adelimbbdelimc", "delim"));

            // make sure regex special characters are treated as normal chars
            TestUtil.IsStringArrayEq("a|bb|c", Utils.SplitByString("a**bb**c", "**"));
            TestUtil.IsStringArrayEq("a|bb|c", Utils.SplitByString("a?bb?c", "?"));
        }
示例#3
0
        static void TestMethod_ValidateGoodFilesSettings()
        {
            var dirFirst  = TestUtil.GetTestSubDirectory("first");
            var dirSecond = TestUtil.GetTestSubDirectory("second");
            var settings  = FormSortFiles.FillFromUI(SortFilesAction.SearchDifferences, "", "",
                                                     dirFirst, dirSecond, true, true, false, false);

            TestUtil.IsEq(true, settings.AllowFiletimesDifferForFAT);
            TestUtil.IsEq(true, settings.AllowFiletimesDifferForDST);
            TestUtil.IsEq(dirSecond, settings.RightDirectory);
            TestUtil.IsTrue(Directory.Exists(Path.GetDirectoryName(settings.LogFile)));
            TestUtil.IsEq(false, settings.Mirror);
            TestUtil.IsEq(false, settings.PreviewOnly);
            TestUtil.IsEq(false, settings.SearchDuplicatesCanUseFiletimes);
            TestUtil.IsStringArrayEq(null, settings.SkipDirectories);
            TestUtil.IsStringArrayEq(null, settings.SkipFiles);
            TestUtil.IsEq(dirFirst, settings.LeftDirectory);

            settings = FormSortFiles.FillFromUI(
                SortFilesAction.SearchDifferences, "a", "a\nb b\n\nc\n\n ",
                dirSecond, dirFirst, false, false, true, true);

            TestUtil.IsEq(false, settings.AllowFiletimesDifferForFAT);
            TestUtil.IsEq(false, settings.AllowFiletimesDifferForDST);
            TestUtil.IsEq(dirFirst, settings.RightDirectory);
            TestUtil.IsTrue(Directory.Exists(Path.GetDirectoryName(settings.LogFile)));
            TestUtil.IsEq(true, settings.Mirror);
            TestUtil.IsEq(true, settings.PreviewOnly);
            TestUtil.IsEq(false, settings.SearchDuplicatesCanUseFiletimes);
            TestUtil.IsStringArrayEq("a", settings.SkipDirectories);
            TestUtil.IsStringArrayEq("a|b b|c", settings.SkipFiles);
            TestUtil.IsEq(dirSecond, settings.LeftDirectory);

            settings = FormSortFiles.FillFromUI(SortFilesAction.SearchDuplicatesInOneDir, "", "",
                                                dirFirst, dirSecond, false, false, true, true);

            TestUtil.IsEq(dirFirst, settings.LeftDirectory);
            TestUtil.IsEq(dirFirst, settings.RightDirectory);
            TestUtil.IsEq(false, settings.SearchDuplicatesCanUseFiletimes);

            settings = FormSortFiles.FillFromUI(SortFilesAction.SearchDuplicates, "", "",
                                                dirFirst, dirSecond, true, true, false, false);
            TestUtil.IsEq(true, settings.AllowFiletimesDifferForFAT);
            TestUtil.IsEq(true, settings.AllowFiletimesDifferForDST);
            TestUtil.IsEq(true, settings.SearchDuplicatesCanUseFiletimes);
        }