Exemple #1
0
        static void TestMethod_SyncConfiguration_Serialize()
        {
            var config = new SyncConfiguration();

            config.m_src          = "chg8";
            config.m_destination  = "chg9";
            config.m_excludeDirs  = "chg10";
            config.m_excludeFiles = "chg11";
            config.m_mirror       = false;
            config.m_copySubDirsAndEmptySubdirs = true;
            config.m_copyFlags          = "#1@";
            config.m_directoryCopyFlags = "#2@";
            config.m_ipg                = "#3@";
            config.m_nRetries           = "#4@";
            config.m_waitBetweenRetries = "#5@";
            config.m_nThreads           = "#6@";
            config.m_custom             = "#7@";
            config.m_symlinkNotTarget   = false;
            config.m_fatTimes           = true;
            config.m_compensateDst      = false;
            File.Delete(Testing.GetTestTempFile("test_cfg_02_got.xml"));
            SyncConfiguration.Serialize(config, Testing.GetTestTempFile("test_cfg_02_got.xml"));
            string sExpected = File.ReadAllText(Testing.GetTestFile("test_cfg_02.xml"));
            string sGot      = File.ReadAllText(Testing.GetTestTempFile("test_cfg_02_got.xml"));

            sGot      = sGot.Replace("xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"");
            sExpected = sExpected.Replace("\r", "").Replace("\n", "").Replace("  <", "<");
            sGot      = sGot.Replace("\r", "").Replace("\n", "").Replace("  <", "<");
            Utils.AssertEq(sExpected, sGot);
        }
Exemple #2
0
        static void TestMethod_GetCommandLineParameters02()
        {
            var config     = SyncConfiguration.Deserialize(Testing.GetTestFile("test_cfg_02.xml"));
            var sArguments = RunImplementation.GetCommandLineArgs(config);
            var sExpected  = " \"chg8\" \"chg9\"  /XD \"chg10\"  /XF \"chg11\"  /E  /COPY:#1@  /DCOPY:#2@  /IPG:#3@  /R:#4@  /W:#5@  /MT:#6@  #7@  /FFT ";

            Utils.AssertEq(sExpected, sArguments);
        }
Exemple #3
0
        static void TestMethod_GetCommandLineParameters01()
        {
            var config     = SyncConfiguration.Deserialize(Testing.GetTestFile("test_cfg_01.xml"));
            var sArguments = RunImplementation.GetCommandLineArgs(config);
            var sExpected  = " \"chg1\" \"chg2\"  /XD \"chg3\"  /XF \"chg4\"  /MIR  /COPY:#1  /DCOPY:#2  /IPG:#3  /R:#4  /W:#5  /MT:#6  #7  /SL  /DST ";

            Utils.AssertEq(sExpected, sArguments);
        }
        static void Test_CheckUIElementsAfterLoad(FormSyncMain form)
        {
            var prevConfig = form.GetCurrentConfigFromUI();
            var config1    = SyncConfiguration.Deserialize(Testing.GetTestFile("test_cfg_01.xml"));

            form.SetCurrentConfigToUI(config1);
            Test_CheckUIElements(config1, form);
            var config2 = SyncConfiguration.Deserialize(Testing.GetTestFile("test_cfg_02.xml"));

            form.SetCurrentConfigToUI(config2);
            Test_CheckUIElements(config2, form);
            form.SetCurrentConfigToUI(prevConfig);
        }
        static void Test_SaveFromUIElements(FormSyncMain form)
        {
            var prevConfig = form.GetCurrentConfigFromUI();
            var config1    = SyncConfiguration.Deserialize(Testing.GetTestFile("test_cfg_01.xml"));

            form.SetCurrentConfigToUI(config1);
            var config2 = SyncConfiguration.Deserialize(Testing.GetTestFile("test_cfg_02.xml"));

            Test_SetUIElements(config2, form);
            var config2FromForm = form.GetCurrentConfigFromUI();

            File.Delete(Testing.GetTestTempFile("test_cfg_02_got.xml"));
            SyncConfiguration.Serialize(config2FromForm, Testing.GetTestTempFile("test_cfg_02_got.xml"));
            string sExpected = File.ReadAllText(Testing.GetTestFile("test_cfg_02.xml"));
            string sGot      = File.ReadAllText(Testing.GetTestTempFile("test_cfg_02_got.xml"));

            form.SetCurrentConfigToUI(prevConfig);
        }
Exemple #6
0
        static void TestMethod_SyncConfiguration_Deserialize()
        {
            var config = SyncConfiguration.Deserialize(Testing.GetTestFile("test_cfg_01.xml"));

            Utils.AssertEq(config.m_src, "chg1");
            Utils.AssertEq(config.m_destination, "chg2");
            Utils.AssertEq(config.m_excludeDirs, "chg3");
            Utils.AssertEq(config.m_excludeFiles, "chg4");
            Utils.AssertEq(config.m_mirror, true);
            Utils.AssertEq(config.m_copySubDirsAndEmptySubdirs, false);
            Utils.AssertEq(config.m_copyFlags, "#1");
            Utils.AssertEq(config.m_directoryCopyFlags, "#2");
            Utils.AssertEq(config.m_ipg, "#3");
            Utils.AssertEq(config.m_nRetries, "#4");
            Utils.AssertEq(config.m_waitBetweenRetries, "#5");
            Utils.AssertEq(config.m_nThreads, "#6");
            Utils.AssertEq(config.m_custom, "#7");
            Utils.AssertEq(config.m_symlinkNotTarget, true);
            Utils.AssertEq(config.m_fatTimes, false);
            Utils.AssertEq(config.m_compensateDst, true);
        }