示例#1
0
        public void Script_BATCH_NO_CONCURRENT()
        {
            //TODO: this test could fail if there is no empty folder within /home/usuario/test (with no hidden folders)
            var s = new AutoCheck.Core.Script(GetSampleFile("batch_run_ok11.yaml"));

            Assert.AreEqual("Running script batch_run_ok11 (v1.0.0.0):\r\nRunning on batch mode for localhost:\r\n   This is the value for LOCAL_VAR1: LOCAL1\r\n   This is the value for LOCAL_VAR2: LOCAL2\r\n\r\nRunning script batch_run_ok11 (v1.0.0.0):\r\nRunning on batch mode for localhost:\r\n   This is the value for LOCAL_VAR1: LOCAL3\r\n   This is the value for LOCAL_VAR2: LOCAL4", s.Output.ToString());
        }
示例#2
0
        public void Script_QUESTION_BATCH_MULTI_METHODS()
        {
            var s   = new AutoCheck.Core.Script(GetSampleFile("question_ok8.yaml"));
            var log = s.Output.ToString();

            Assert.AreEqual("Running script question_ok8 (v1.0.0.1):\r\n   Question 1 [1 point]:\r\n      Checking files... OK\r\n      Getting files... OK\r\n\r\n   Question 2 [1 point]:\r\n      Counting folders... ERROR:\n         -Expected -> -1; Found -> 0\r\n\r\n   TOTAL SCORE: 5 / 10", log);
        }
示例#3
0
        public void ParseVars_COMPUTED_OPPERATION()
        {
            //NOTE: needs a remote GNU users to work (usuario@usuario)
            var s = new AutoCheck.Core.Script(GetSampleFile("vars_ok5.yaml"));

            Assert.AreEqual("Running script vars_ok5 (v1.0.0.0):\r\n   Running opperation 1+2+3: OK", s.Output.ToString());
        }
示例#4
0
        public void Output_BATCH_FILE_3()
        {
            var path = Path.Combine(LogRootFolder, "script", "output", "output_batch_3_yaml");

            if (Directory.Exists(path))
            {
                Directory.Delete(path, true);
            }

            var logs = new string[] {
                Path.Combine(path, "OUTPUT BATCH 3_Student Name 1.log"),
                Path.Combine(path, "OUTPUT BATCH 3_Student Name 2.log"),
                Path.Combine(path, "OUTPUT BATCH 3_Student Name 3.log")
            };

            if (Directory.Exists(path))
            {
                foreach (var l in logs)
                {
                    Assert.IsFalse(File.Exists(Core.Utils.PathToCurrentOS(l)));
                }
            }

            var i = 0;
            var s = new AutoCheck.Core.Script(GetSampleFile("output_batch_3.yaml"));

            Assert.AreEqual(3, Directory.GetFiles(path).Length);

            foreach (var l in logs)
            {
                Assert.IsTrue(File.Exists(l));
                Assert.IsTrue(File.ReadAllText(l).Equals(s.Output.GetLog()[i++].ToJson()));
            }
        }
示例#5
0
        public void Script_RUN_CAPTION_OK()
        {
            var s   = new AutoCheck.Core.Script(GetSampleFile("run_ok3.yaml"));
            var log = s.Output.ToString();

            Assert.AreEqual("Running script run_ok3 (v1.0.0.1):\r\n   Checking if file exists... OK", log);
        }
示例#6
0
        public void Script_BATCH_REMOTE_FOLDER()
        {
            //TODO: this test could fail if there is no empty folder within /home/usuario/test (with no hidden folders)
            var s = new AutoCheck.Core.Script(GetSampleFile("batch_run_ok8.yaml"));

            Assert.AreEqual("Running script batch_run_ok8 (v1.0.0.0):\r\nRunning on batch mode for localhost:\r\n   Question 1 [1 point]:\r\n      Testing echo command... OK\r\n\r\n   TOTAL SCORE: 10 / 10\r\n\r\nRunning script batch_run_ok8 (v1.0.0.0):\r\nRunning on batch mode for localhost:\r\n   Question 1 [1 point]:\r\n      Testing echo command... OK\r\n\r\n   TOTAL SCORE: 10 / 10", s.Output.ToString());
        }
示例#7
0
        public void Script_RUN_CAPTION_ERROR()
        {
            var s   = new AutoCheck.Core.Script(GetSampleFile("run_ok4.yaml"));
            var log = s.Output.ToString();

            Assert.AreEqual("Running script run_ok4 (v1.0.0.1):\r\n   Checking if file exists... OK\r\n   Counting folders... ERROR:\n      -Expected -> Wanted ERROR!; Found -> 0", log);
        }
示例#8
0
        public void Script_BATCH_PRE_UNZIP()
        {
            var dest  = Path.Combine(Path.GetDirectoryName(TempScriptFolder), "test6"); //the script will use this folder, so no random path can be used
            var dest1 = Path.Combine(dest, "folder1");
            var dest2 = Path.Combine(dest, "folder2");

            if (!Directory.Exists(dest1))
            {
                Directory.CreateDirectory(dest1);
            }
            if (!Directory.Exists(dest2))
            {
                Directory.CreateDirectory(dest2);
            }

            File.Copy(GetSampleFile("zip", "nopass.zip"), GetSampleFile(dest1, "nopass.zip"));
            File.Copy(GetSampleFile("zip", "nopass.zip"), GetSampleFile(dest2, "nopass.zip"));

            Assert.IsTrue(File.Exists(GetSampleFile(dest1, "nopass.zip")));
            Assert.IsTrue(File.Exists(GetSampleFile(dest2, "nopass.zip")));

            var s = new AutoCheck.Core.Script(GetSampleFile("batch_run_ok6.yaml"));

            Assert.AreEqual($"Running script batch_run_ok6 (v1.0.0.1):\r\n   Extracting files at: folder1\r\n      Extracting the file nopass.zip... OK\r\n\r\n   Extracting files at: folder2\r\n      Extracting the file nopass.zip... OK\r\n\r\n   Starting the copy detector for PlainText:\r\n      Looking for potential copies within folder1... OK\r\n      Looking for potential copies within folder2... OK\r\n\r\nRunning on batch mode for folder1:\r\n   Potential copy detected for {Core.Utils.PathToCurrentOS("folder1/nopass.txt")}:\r\n      Match score with {Core.Utils.PathToCurrentOS("folder2/nopass.txt")}... 100,00 %\r\n\r\nRunning script batch_run_ok6 (v1.0.0.1):\r\n   Extracting files at: folder1\r\n      Extracting the file nopass.zip... OK\r\n\r\n   Extracting files at: folder2\r\n      Extracting the file nopass.zip... OK\r\n\r\n   Starting the copy detector for PlainText:\r\n      Looking for potential copies within folder1... OK\r\n      Looking for potential copies within folder2... OK\r\n\r\nRunning on batch mode for folder2:\r\n   Potential copy detected for {Core.Utils.PathToCurrentOS("folder2/nopass.txt")}:\r\n      Match score with {Core.Utils.PathToCurrentOS("folder1/nopass.txt")}... 100,00 %", s.Output.ToString());

            Directory.Delete(dest, true);
        }
示例#9
0
        public void Script_QUESTION_BATCH_SUBQUESTION_RUN()
        {
            var s   = new AutoCheck.Core.Script(GetSampleFile("question_ok11.yaml"));
            var log = s.Output.ToString();

            Assert.AreEqual("Running script question_ok11 (v1.0.0.0):\r\n   Question 1 [2 points]:\r\n\r\n      Question 1.1 [1 point]:\r\n         Running echo... OK\r\n\r\n      Question 1.2 [1 point]:\r\n         Running echo... ERROR:\n            -Expected -> Wanted Error!; Found -> Hello\r\n\r\n   TOTAL SCORE: 5 / 10", log);
        }
示例#10
0
        public void Script_QUESTION_BATCH_ONERROR_ABORT()
        {
            var s   = new AutoCheck.Core.Script(GetSampleFile("question_ok13.yaml"));
            var log = s.Output.ToString();

            Assert.AreEqual("Running script question_ok13 (v1.0.0.0):\r\n   Question 1 [2 points]:\r\n      Running echo One... OK\r\n\r\n      Question 1.1 [1 point]:\r\n         Running echo Two... ERROR:\n            -Expected -> WANTEDERROR; Found -> Two\r\n\r\n\r\n   Aborting execution!\r\n\r\n   TOTAL SCORE: 0 / 10", log);
        }
示例#11
0
        public void Script_BATCH_RUN_COMBO_INTERNAL()
        {
            var dest  = Path.Combine(Path.GetDirectoryName(TempScriptFolder), "test4"); //the script will use this folder, so no random path can be used
            var dest1 = Path.Combine(dest, "folder1");
            var dest2 = Path.Combine(dest, "folder2");

            if (!Directory.Exists(dest1))
            {
                Directory.CreateDirectory(dest1);
            }
            if (!Directory.Exists(dest2))
            {
                Directory.CreateDirectory(dest2);
            }

            File.Copy(GetSampleFile("zip", "nopass.zip"), GetSampleFile(dest1, "nopass.zip"));
            File.Copy(GetSampleFile("zip", "nopass.zip"), GetSampleFile(dest2, "nopass.zip"));

            Assert.IsTrue(File.Exists(GetSampleFile(dest1, "nopass.zip")));
            Assert.IsTrue(File.Exists(GetSampleFile(dest2, "nopass.zip")));

            //NOTE: Folder order matters, folder order is as in the script, folders within a given path are collected sorted by name
            var s = new AutoCheck.Core.Script(GetSampleFile("batch_run_ok4.yaml"));

            Assert.AreEqual($"Running script batch_run_ok4 (v1.0.0.1):\r\nRunning script batch_run_ok4 (v1.0.0.1) in batch mode for {Path.GetFileName(dest1)}:\r\n\r\nRunning script batch_run_ok4 (v1.0.0.1):\r\nRunning script batch_run_ok4 (v1.0.0.1) in batch mode for {Path.GetFileName(dest2)}:\r\n\r\nRunning script batch_run_ok4 (v1.0.0.1):\r\nRunning script batch_run_ok4 (v1.0.0.1) in batch mode for {Path.GetFileName(dest1)}:\r\n\r\nRunning script batch_run_ok4 (v1.0.0.1):\r\nRunning script batch_run_ok4 (v1.0.0.1) in batch mode for {Path.GetFileName(dest2)}:", s.Output.ToString());

            Directory.Delete(dest, true);
        }
示例#12
0
        public void Script_QUESTION_DEFAULT_MULTI_METHODS()
        {
            var s   = new AutoCheck.Core.Script(GetSampleFile("question_ok7.yaml"));
            var log = s.Output.ToString();

            Assert.AreEqual("Running script question_ok7 (v1.0.0.1):\r\n   Question 1 [1 point]:\r\n      Checking files... OK\r\n      Getting files... OK\r\n\r\n   TOTAL SCORE: 10 / 10", log);
        }
示例#13
0
        public void Script_QUESTION_DEFAULT_MULTI_ECHO()
        {
            var s   = new AutoCheck.Core.Script(GetSampleFile("question_ok2.yaml"));
            var log = s.Output.ToString();

            Assert.AreEqual("Running script question_ok2 (v1.0.0.0):\r\n   Question 1 [1 point]:\r\n      Running echo (1/2)... OK\r\n      Running echo (2/2)... OK\r\n\r\n   TOTAL SCORE: 10 / 10", log);
        }
示例#14
0
        public void Script_QUESTION_BATCH_MULTI_SCORE()
        {
            var s   = new AutoCheck.Core.Script(GetSampleFile("question_ok5.yaml"));
            var log = s.Output.ToString();

            Assert.AreEqual("Running script question_ok5 (v1.0.0.0):\r\n   Question 1 [2 points]:\r\n      Running echo (1/2)... OK\r\n      Running echo (2/2)... OK\r\n\r\n   Question 2 [1 point]:\r\n      Running echo (1/2)... OK\r\n      Running echo (2/2)... ERROR:\n         -Expected -> Wanted fail!; Found -> This is NOT OK\r\n\r\n   TOTAL SCORE: 6.67 / 10", log);
        }
示例#15
0
        public void Script_QUESTION_BATCH_MULTI_DESCRIPTION()
        {
            var s   = new AutoCheck.Core.Script(GetSampleFile("question_ok6.yaml"));
            var log = s.Output.ToString();

            Assert.AreEqual("Running script question_ok6 (v1.0.0.0):\r\n   My custom caption for the question 1 - My custom description with score 3/10 (TOTAL: 0):\r\n      Running echo (1/2)... OK\r\n      Running echo (2/2)... ERROR:\n         -Expected -> Error wanted!; Found -> Hello\r\n\r\n   My custom caption for the question 2 - My custom description with score 2/10 (TOTAL: 0):\r\n      Running echo... OK\r\n\r\n   My custom caption for the question 3 - My custom description with score 5/10 (TOTAL: 4):\r\n      Running echo (1/3)... OK\r\n      Running echo (2/3)... OK\r\n      Running echo (3/3)... OK\r\n\r\n   TOTAL SCORE: 7 / 10", log);
        }
示例#16
0
        public void Script_COPY_PLAINTEXT_FOLDERS_NOTCOPY()
        {
            var dest  = Path.Combine(Path.GetDirectoryName(TempScriptFolder), "test2"); //the script will use this folder, so no random path can be used
            var dest1 = Path.Combine(dest, "folder1");
            var dest2 = Path.Combine(dest, "folder2");

            if (!Directory.Exists(dest1))
            {
                Directory.CreateDirectory(dest1);
            }
            if (!Directory.Exists(dest2))
            {
                Directory.CreateDirectory(dest2);
            }

            File.Copy(GetSampleFile("plaintext", "lorem1.txt"), GetSampleFile(dest1, "sample1.txt"));
            File.Copy(GetSampleFile("plaintext", "lorem2.txt"), GetSampleFile(dest2, "sample2.txt"));

            Assert.IsTrue(File.Exists(GetSampleFile(dest1, "sample1.txt")));
            Assert.IsTrue(File.Exists(GetSampleFile(dest2, "sample2.txt")));

            var s = new AutoCheck.Core.Script(GetSampleFile("copy_plaintext_ok2.yaml"));

            Assert.AreEqual($"Running script copy_plaintext_ok2 (v1.0.0.0):\r\n   Starting the copy detector for PLAINTEXT:\r\n      Looking for potential copies within folder1... OK\r\n      Looking for potential copies within folder2... OK\r\n\r\nRunning on batch mode for folder1:\r\n\r\nRunning script copy_plaintext_ok2 (v1.0.0.0):\r\n   Starting the copy detector for PLAINTEXT:\r\n      Looking for potential copies within folder1... OK\r\n      Looking for potential copies within folder2... OK\r\n\r\nRunning on batch mode for folder2:", s.Output.ToString());
            Directory.Delete(dest, true);
        }
示例#17
0
        public void Script_BATCH_RUN_PATH()
        {
            var dest  = Path.Combine(Path.GetDirectoryName(TempScriptFolder), "test3"); //the script will use this folder, so no random path can be used
            var dest1 = Path.Combine(dest, "folder1");
            var dest2 = Path.Combine(dest, "folder2");

            if (!Directory.Exists(dest1))
            {
                Directory.CreateDirectory(dest1);
            }
            if (!Directory.Exists(dest2))
            {
                Directory.CreateDirectory(dest2);
            }

            File.Copy(GetSampleFile("zip", "nopass.zip"), GetSampleFile(dest1, "nopass.zip"));
            File.Copy(GetSampleFile("zip", "nopass.zip"), GetSampleFile(dest2, "nopass.zip"));

            Assert.IsTrue(File.Exists(GetSampleFile(dest1, "nopass.zip")));
            Assert.IsTrue(File.Exists(GetSampleFile(dest2, "nopass.zip")));

            var s = new AutoCheck.Core.Script(GetSampleFile("batch_run_ok3.yaml"));

            Assert.AreEqual($"Running script batch_run_ok3 (v1.0.0.1):\r\nRunning on batch mode:\r\n\r\nRunning script batch_run_ok3 (v1.0.0.1):\r\nRunning on batch mode:", s.Output.ToString());

            Directory.Delete(dest, true);
        }
示例#18
0
 public void Script_INHERITS_VARS_REPLACE()
 {
     try{
         var s = new AutoCheck.Core.Script(GetSampleFile("inherits_vars_ok1.yaml"));
     }
     catch (ResultMismatchException ex) {
         Assert.AreEqual("Expected -> Fer; Found -> New Fer", ex.Message);
     }
 }
示例#19
0
        public void Output_SINGLE_FILE_1()
        {
            var logFilePath = Path.Combine(LogRootFolder, "script", "output", "output_single_1_yaml", "OUTPUT SINGLE 1_Student Name 1.log");

            if (File.Exists(logFilePath))
            {
                File.Delete(logFilePath);
            }

            var s = new AutoCheck.Core.Script(GetSampleFile("output_single_1.yaml"));

            Assert.AreEqual(logFilePath, Core.Utils.PathToCurrentOS(s.LogFiles.FirstOrDefault()));
            Assert.IsTrue(File.Exists(logFilePath));
            Assert.IsTrue(File.ReadAllText(logFilePath).Equals(s.Output.GetLog().LastOrDefault().ToText()));
        }
示例#20
0
        public void Script_INHERITS_RUN_FOLDER()
        {
            var dest = Path.Combine(Path.GetDirectoryName(TempScriptFolder), "test2");  //the script will use this folder, so no random path can be used

            if (!Directory.Exists(dest))
            {
                Directory.CreateDirectory(dest);
            }

            File.Copy(GetSampleFile("zip", "nopass.zip"), GetSampleFile(dest, "nopass.zip"));
            Assert.IsTrue(File.Exists(GetSampleFile(dest, "nopass.zip")));
            var s = new AutoCheck.Core.Script(GetSampleFile("inherits_run_ok1.yaml"));

            Assert.AreEqual($"Running script inherits_run_ok1 (v1.0.0.1):\r\nRunning script inherits_run_ok1 (v1.0.0.1) in single mode for {dest}:", s.Output.ToString());
            Directory.Delete(dest, true);
        }
示例#21
0
        public void Script_SCRIPT_SINGLE_ONEXCEPTION_SUCCESS()
        {
            var dest = Path.Combine(Path.GetDirectoryName(TempScriptFolder), "test4");  //the script will use this folder, so no random path can be used

            if (!Directory.Exists(dest))
            {
                Directory.CreateDirectory(dest);
            }

            File.Copy(GetSampleFile("html", "incorrect.html"), GetSampleFile(dest, "index.html"));
            Assert.IsTrue(File.Exists(GetSampleFile(dest, "index.html")));

            var s = new AutoCheck.Core.Script(GetSampleFile("dummy_single_4.yaml"));

            Assert.AreEqual("Running script Test Script #3 (v1.0.0.1):\r\nRunning on single mode:\r\n   Question 1 [2 points] - Checking Index.html:\r\n      Looking for index.html... OK\r\n      Validating document against the W3C validation service... OK\r\n\r\n      Question 1.1 [1 point] - Validating headers:\r\n         Checking amount of level-1 headers... OK\r\n         Checking amount of level-2 headers... ERROR:\n            -Expected -> >=1; Found -> 0\r\n\r\n      Question 1.2 [1 point] - Validating paragraphs:\r\n         Checking amount of paragraphs... OK\r\n         Checking content legth within paragraphs... ERROR:\n            -Expected -> >=1500; Found -> 10\r\n\r\n   TOTAL SCORE: 0 / 10", s.Output.ToString());
        }
示例#22
0
        public void Script_SCRIPT_SINGLE_ONEXCEPTION_ABORT()
        {
            var dest = Path.Combine(Path.GetDirectoryName(TempScriptFolder), "test2");  //the script will use this folder, so no random path can be used

            if (!Directory.Exists(dest))
            {
                Directory.CreateDirectory(dest);
            }

            File.Copy(GetSampleFile("html", "incorrect.html"), GetSampleFile(dest, "index.html"));
            Assert.IsTrue(File.Exists(GetSampleFile(dest, "index.html")));

            var s = new AutoCheck.Core.Script(GetSampleFile("dummy_single_2.yaml"));

            Assert.AreEqual("Running script Test Script #1 (v1.0.0.1):\r\nRunning on single mode:\r\n   Question 1 [2 points] - Checking Index.html:\r\n      Looking for index.html... OK\r\n      Validating document against the W3C validation service... ERROR:\n         -No p element in scope but a p end tag seen.</h1>\n             </p>\n         </bod\r\n\r\n   Aborting execution!\r\n\r\n   TOTAL SCORE: 0 / 10", s.Output.ToString());
        }
示例#23
0
        public void Script_SCRIPT_ARGUMENT_TYPE_CONNECTOR_KO()
        {
            var dest = Path.Combine(Path.GetDirectoryName(TempScriptFolder), "test8");  //the script will use this folder, so no random path can be used

            if (!Directory.Exists(dest))
            {
                Directory.CreateDirectory(dest);
            }

            File.Copy(GetSampleFile("html", "correct.html"), GetSampleFile(dest, "index.html"));
            File.Copy(GetSampleFile("css", "correct.css"), GetSampleFile(dest, "index.css"));
            Assert.IsTrue(File.Exists(GetSampleFile(dest, "index.html")));
            Assert.IsTrue(File.Exists(GetSampleFile(dest, "index.css")));

            var s = new AutoCheck.Core.Script(GetSampleFile("dummy_single_8.yaml"));

            Assert.AreEqual("Running script Test Script #7 (v1.0.0.1):\r\nRunning on single mode:\r\n   Question 1 [1 point] - Checking index.css:\r\n      Looking for index.css... OK\r\n      Validating document against the W3C validation service... OK\r\n\r\n      Question 1.1 [1 point] - Validating font property:\r\n         Checking if the font property has been created... OK\r\n         Checking if the font property has NOT been applied... ERROR:\n            -Unable to find any connector named 'Html'.\r\n\r\n   TOTAL SCORE: 0 / 10", s.Output.ToString());
        }
示例#24
0
        public void Script_SCRIPT_ARGUMENT_TYPE_CONNECTOR_TUPLE()
        {
            var dest = Path.Combine(Path.GetDirectoryName(TempScriptFolder), "test9");  //the script will use this folder, so no random path can be used

            if (!Directory.Exists(dest))
            {
                Directory.CreateDirectory(dest);
            }

            File.Copy(GetSampleFile("html", "correct.html"), GetSampleFile(dest, "index.html"));
            File.Copy(GetSampleFile("css", "correct.css"), GetSampleFile(dest, "index.css"));
            Assert.IsTrue(File.Exists(GetSampleFile(dest, "index.html")));
            Assert.IsTrue(File.Exists(GetSampleFile(dest, "index.css")));

            var s = new AutoCheck.Core.Script(GetSampleFile("dummy_single_9.yaml"));

            Assert.AreEqual("Running script Test Script #8 (v1.0.0.1):\r\nRunning on single mode:\r\n   Question 1 [1 point] - Checking index.css:\r\n      Looking for index.html... OK\r\n      Looking for index.css... OK\r\n      Validating document against the W3C validation service... OK\r\n\r\n      Question 1.1 [1 point] - Validating set of properties:\r\n         Checking if the (top | right | bottom | left) property has been created... OK\r\n\r\n   TOTAL SCORE: 10 / 10", s.Output.ToString());
        }
示例#25
0
        public void Script_BATCH_LOCAL_VARS()
        {
            var dest  = Path.Combine(Path.GetDirectoryName(TempScriptFolder), "test9"); //the script will use this folder, so no random path can be used
            var dest1 = Path.Combine(dest, "folder1");
            var dest2 = Path.Combine(dest, "folder2");

            if (!Directory.Exists(dest1))
            {
                Directory.CreateDirectory(dest1);
            }
            if (!Directory.Exists(dest2))
            {
                Directory.CreateDirectory(dest2);
            }

            var s = new AutoCheck.Core.Script(GetSampleFile("batch_run_ok9.yaml"));

            Assert.AreEqual("Running script batch_run_ok9 (v1.0.0.0):\r\nRunning on batch mode for folder1:\r\n   This is the value for LOCAL_VAR1: LOCAL1\r\n   This is the value for LOCAL_VAR2: LOCAL2\r\n\r\nRunning script batch_run_ok9 (v1.0.0.0):\r\nRunning on batch mode for folder2:\r\n   This is the value for LOCAL_VAR1: LOCAL1\r\n   This is the value for LOCAL_VAR2: LOCAL2\r\n\r\nRunning script batch_run_ok9 (v1.0.0.0):\r\nRunning on batch mode for test9:\r\n   This is the value for LOCAL_VAR1: LOCAL3\r\n   This is the value for LOCAL_VAR2: LOCAL4", s.Output.ToString());
        }
示例#26
0
        public void Output_BATCH_FILE_2()
        {
            var path = Path.Combine(LogRootFolder, "script", "output", "output_batch_2_yaml");

            if (Directory.Exists(path))
            {
                Directory.Delete(path, true);
            }

            var i = 0;
            var s = new AutoCheck.Core.Script(GetSampleFile("output_batch_2.yaml"));

            Assert.AreEqual(3, Directory.GetFiles(path).Length);

            foreach (var l in s.LogFiles)
            {
                var logFile = Core.Utils.PathToCurrentOS(l);

                Assert.IsTrue(File.Exists(logFile));
                Assert.IsTrue(File.ReadAllText(logFile).Equals(s.Output.GetLog()[i++].ToText()));
            }
        }
示例#27
0
        public void Setup_ECHO()
        {
            var dest  = Path.Combine(Path.GetDirectoryName(TempScriptFolder), "test1"); //the script will use this folder, so no random path can be used
            var dest1 = Path.Combine(dest, "folder1");
            var dest2 = Path.Combine(dest, "folder2");

            if (!Directory.Exists(dest1))
            {
                Directory.CreateDirectory(dest1);
            }
            if (!Directory.Exists(dest2))
            {
                Directory.CreateDirectory(dest2);
            }

            dest1 = Path.GetFileName(dest1);
            dest2 = Path.GetFileName(dest2);

            var s = new AutoCheck.Core.Script(GetSampleFile("setup_ok1.yaml"));

            Assert.AreEqual($"Running script setup_ok1 (v1.0.0.0):\r\n   Echo for setup execution over folder1\r\n\r\n   Echo for setup execution over folder2\r\n\r\nRunning on batch mode for folder1:\r\n   Echo for pre execution over folder1\r\n\r\n   Echo for body execution over folder1\r\n\r\n   Echo for post execution over folder1\r\n\r\n   Echo for teardown execution over folder1\r\n\r\n   Echo for teardown execution over folder2\r\n\r\nRunning script setup_ok1 (v1.0.0.0):\r\n   Echo for setup execution over folder1\r\n\r\n   Echo for setup execution over folder2\r\n\r\nRunning on batch mode for folder2:\r\n   Echo for pre execution over folder2\r\n\r\n   Echo for body execution over folder2\r\n\r\n   Echo for post execution over folder2\r\n\r\n   Echo for teardown execution over folder1\r\n\r\n   Echo for teardown execution over folder2", s.Output.ToString());
        }
示例#28
0
        public void Script_BATCH_REMOTE_ECHO()
        {
            var s = new AutoCheck.Core.Script(GetSampleFile("batch_run_ok7.yaml"));

            Assert.AreEqual("Running script batch_run_ok7 (v1.0.0.0):\r\nRunning on batch mode for localhost:\r\n   Question 1 [1 point]:\r\n      Testing echo command... OK\r\n\r\n   TOTAL SCORE: 10 / 10\r\n\r\nRunning script batch_run_ok7 (v1.0.0.0):\r\nRunning on batch mode for 127.0.0.1:\r\n   Question 1 [1 point]:\r\n      Testing echo command... OK\r\n\r\n   TOTAL SCORE: 10 / 10", s.Output.ToString());
        }
示例#29
0
        public void Script_RUN_EMPTY()
        {
            var s = new AutoCheck.Core.Script(GetSampleFile("run_ok6.yaml"));

            Assert.AreEqual("Running script run_ok6 (v1.0.0.0):", s.Output.ToString());
        }
示例#30
0
文件: Echo.cs 项目: FherStk/AutoCheck
        public void Script_ECHO_CONTENT()
        {
            var s = new AutoCheck.Core.Script(GetSampleFile("echo_ok2.yaml"));

            Assert.AreEqual("Running script echo_ok2 (v1.0.0.0):\r\n   ECHO 1\r\n   Question 1 [1 point]:\r\n      ECHO 2\r\n\r\n   TOTAL SCORE: 10 / 10", s.Output.ToString());
        }