Exemple #1
0
        public void FilesExistTest()
        {
            Helper.StartWorkflow(42);

            // Check the workflow result
            string[] files = Directory.GetFiles(TempFolder, "FilesExist*.xml", SearchOption.AllDirectories);
            Assert.AreEqual(files.Length, 1);

            string content = File.ReadAllText(files[0]);
            Assert.AreEqual(ExpectedResult, content);
        }
Exemple #2
0
        public void Run()
        {
            string[] files = GetFiles();
            Assert.AreEqual(0, files.Length);
            Helper.StartWorkflow(48);
            files = GetFiles();
            Assert.AreEqual(1, files.Length);
            string content = File.ReadAllText(files[0]);

            Assert.AreEqual(ExpectedResult, content);
        }
Exemple #3
0
        public void Run()
        {
            string[] files = GetFiles();
            Assert.AreEqual(0, files.Length);
            Helper.StartWorkflow(63);
            files = GetFiles();
            Assert.AreEqual(1, files.Length);
            var xdoc  = XDocument.Load(files[0]);
            var count = xdoc.Descendants("Process").Count();

            Assert.AreEqual(1, count);
        }
Exemple #4
0
        public void WmiTest()
        {
            var files = GetFiles();

            Assert.AreEqual(0, files.Length);
            Helper.StartWorkflow(23);
            files = GetFiles();
            Assert.AreEqual(1, files.Length);
            string content = File.ReadAllText(files[0]);

            Assert.AreEqual(_expectedResult, content);
        }
Exemple #5
0
 public void Run()
 {
     string[] files = GetCsvs();
     Assert.AreEqual(0, files.Length);
     Helper.StartWorkflow(17);
     files = GetCsvs();
     Assert.AreEqual(2, files.Length);
     foreach (var file in files)
     {
         string content = File.ReadAllText(file);
         Assert.AreEqual(ExpectedResult, content);
     }
 }
Exemple #6
0
        public void SyncTest()
        {
            Assert.AreEqual(true, Directory.Exists(Src));
            Assert.AreEqual(true, Directory.Exists(Dest));
            string[] files = GetFiles();
            Assert.AreEqual(0, files.Length);
            Helper.StartWorkflow(26);
            files = GetFiles();
            Assert.AreEqual(1, files.Length);
            string content = File.ReadAllText(files[0]);

            Assert.AreEqual(ExpectedResult, content);
        }
Exemple #7
0
        public void Run()
        {
            Stopwatch stopwatch = Stopwatch.StartNew();

            Helper.StartWorkflow(49);
            stopwatch.Stop();
            Assert.IsTrue(stopwatch.ElapsedMilliseconds > 1000 && stopwatch.ElapsedMilliseconds < 2000);
            stopwatch.Reset();
            stopwatch.Start();
            Helper.StartWorkflow(50);
            stopwatch.Stop();
            Assert.IsTrue(stopwatch.ElapsedMilliseconds > 2000);
        }
Exemple #8
0
        public void CsvToXmlTest()
        {
            Helper.StartWorkflow(1);

            // Check the workflow result
            var xmlFiles = Directory.GetFiles(@"C:\WexflowTesting\CsvToXml\", "*.xml");

            Assert.AreEqual(2, xmlFiles.Length);

            foreach (var xmlFile in xmlFiles)
            {
                var xmlContent = File.ReadAllText(xmlFile);
                Assert.AreEqual(ExpectedResult, xmlContent);
            }
        }
Exemple #9
0
        public void ImagesCropperTest()
        {
            Assert.AreEqual(false, File.Exists(Dest1));
            Assert.AreEqual(false, File.Exists(Dest2));
            Assert.AreEqual(false, File.Exists(Dest3));
            Helper.StartWorkflow(74);
            Assert.AreEqual(true, File.Exists(Dest1));
            Assert.AreEqual(true, File.Exists(Dest2));
            Assert.AreEqual(true, File.Exists(Dest3));

            // Checking the image size
            CheckImageSize(Dest1);
            CheckImageSize(Dest2);
            CheckImageSize(Dest3);
        }
Exemple #10
0
        public void Run()
        {
            Assert.IsFalse(File.Exists(File1));
            Assert.IsFalse(File.Exists(File2));
            var files = GetFiles();

            Assert.AreEqual(0, files.Length);
            Helper.StartWorkflow(55); // list+upload+download+delete
            files = GetFiles();
            Assert.AreEqual(1, files.Length);
            var content = File.ReadAllText(files[0]);

            Assert.AreEqual(ExpectedResult, content);
            Assert.IsTrue(File.Exists(File1));
            Assert.IsTrue(File.Exists(File2));
            // TODO sftp and ftps
        }
Exemple #11
0
        public void GuidTest()
        {
            string[] files = GetFiles();
            Assert.AreEqual(0, files.Length);
            Helper.StartWorkflow(68);
            files = GetFiles();
            Assert.AreEqual(1, files.Length);
            var xdoc   = XDocument.Load(files[0]);
            var xguids = xdoc.Descendants("Guid").ToList();

            Assert.AreEqual(3, xguids.Count);
            var regexPattern = @"^([0-9A-Fa-f]{8}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{12})$";

            foreach (var xguid in xguids)
            {
                Assert.IsTrue(Regex.IsMatch(xguid.Value, regexPattern));
            }
        }
Exemple #12
0
        public void Run()
        {
            Helper.StartWorkflow(22);

            // sqlite
            const string sql = "select Id, Description from Data;";

            using (var conn = new SQLiteConnection(SqliteConnectionString))
            {
                var comm = new SQLiteCommand(sql, conn);
                conn.Open();
                using (var reader = comm.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        int    id   = int.Parse(reader["Id"].ToString());
                        string desc = (string)reader["Description"];

                        if (id == 1)
                        {
                            Assert.AreEqual("Hello World Description 1! updated", desc);
                        }
                        else if (id == 2)
                        {
                            Assert.AreEqual("Hello World Description 2! updated", desc);
                        }
                        else if (id == 3)
                        {
                            Assert.AreEqual("Hello World Description 3! updated", desc);
                        }
                        else if (id == 4)
                        {
                            Assert.AreEqual("Hello World Description 4! updated", desc);
                        }
                        else if (id == 5)
                        {
                            Assert.AreEqual("Hello World Description 5!", desc);
                        }
                    }
                }
            }

            // TODO sqlserver|access|oracle|mysql|postgresql|teradata
        }
Exemple #13
0
        public void MediaInfoTest()
        {
            string[] files = GetFiles();
            Assert.AreEqual(0, files.Length);
            Helper.StartWorkflow(52);
            files = GetFiles();
            Assert.AreEqual(1, files.Length);
            string content = File.ReadAllText(files[0]);

            string expectedResultPath = Path.Combine(MediaInfoFolder, System.Guid.NewGuid() + ".xml");
            var    xdoc = Tasks.MediaInfo.MediaInfo.Inform(new[]
            {
                new FileInf(@"C:\WexflowTesting\WAV\kof.wav", 1),
                new FileInf(@"C:\WexflowTesting\MP4\small.mp4", 1)
            });

            xdoc.Save(expectedResultPath);
            var expectedResult = File.ReadAllText(expectedResultPath);

            Assert.AreEqual(expectedResult, content);
        }
Exemple #14
0
        public void Run()
        {
            Stopwatch stopwatch = Stopwatch.StartNew();

            Helper.StartWorkflow(51);
            stopwatch.Stop();

            string day = string.Format(new CultureInfo("en-US"), "{0:dddd}", DateTime.Now);

            switch (day)
            {
            case "Monday":
                Assert.IsTrue(stopwatch.ElapsedMilliseconds > 1000 && stopwatch.ElapsedMilliseconds < 2000);
                break;

            case "Tuesday":
                Assert.IsTrue(stopwatch.ElapsedMilliseconds > 2000 && stopwatch.ElapsedMilliseconds < 3000);
                break;

            case "Wednesday":
                Assert.IsTrue(stopwatch.ElapsedMilliseconds > 3000 && stopwatch.ElapsedMilliseconds < 4000);
                break;

            case "Thursday":
                Assert.IsTrue(stopwatch.ElapsedMilliseconds > 4000 && stopwatch.ElapsedMilliseconds < 5000);
                break;

            case "Friday":
                Assert.IsTrue(stopwatch.ElapsedMilliseconds > 5000 && stopwatch.ElapsedMilliseconds < 6000);
                break;

            case "Saturday":
                Assert.IsTrue(stopwatch.ElapsedMilliseconds > 6000 && stopwatch.ElapsedMilliseconds < 7000);
                break;

            case "Sunday":
                Assert.IsTrue(stopwatch.ElapsedMilliseconds > 7000);
                break;
            }
        }
Exemple #15
0
 public void ProcessKillerTest()
 {
     Helper.StartWorkflow(58);
     Process[] notepadProcesses = Process.GetProcessesByName("notepad");
     Assert.IsTrue(notepadProcesses.Length == 0);
 }
Exemple #16
0
 public void Run()
 {
     Helper.StartWorkflow(4);
     Assert.AreEqual(true, File.Exists(Dest));
 }
Exemple #17
0
 public void Run()
 {
     Assert.AreEqual(false, File.Exists(SrcRenamed));
     Helper.StartWorkflow(36);
     Assert.AreEqual(true, File.Exists(SrcRenamed));
 }
Exemple #18
0
 public void ZipTest()
 {
     Assert.AreEqual(false, File.Exists(ZipFile));
     Helper.StartWorkflow(19);
     Assert.AreEqual(true, File.Exists(ZipFile));
 }
Exemple #19
0
 public void TorrentTest()
 {
     Assert.IsFalse(File.Exists(DownloadedFile));
     Helper.StartWorkflow(72);
     Assert.IsTrue(File.Exists(DownloadedFile));
 }
Exemple #20
0
 public void FilesRemoverTest()
 {
     Assert.AreEqual(true, File.Exists(Src));
     Helper.StartWorkflow(5);
     Assert.AreEqual(false, File.Exists(Src));
 }
Exemple #21
0
 public void Run()
 {
     Assert.AreEqual(false, File.Exists(TgzFile));
     Helper.StartWorkflow(21);
     Assert.AreEqual(true, File.Exists(TgzFile));
 }
Exemple #22
0
 public void HttpTest()
 {
     Assert.AreEqual(false, File.Exists(Dest));
     Helper.StartWorkflow(25);
     Assert.AreEqual(true, File.Exists(Dest));
 }
Exemple #23
0
 public void ListEntitiesTest()
 {
     Helper.StartWorkflow(7);
     // TODO
 }
Exemple #24
0
 public void RmdirTest()
 {
     Assert.AreEqual(true, Directory.Exists(Src));
     Helper.StartWorkflow(14);
     Assert.AreEqual(false, Directory.Exists(Src));
 }
Exemple #25
0
 public void Run()
 {
     Helper.StartWorkflow(7);
     // TODO
 }
Exemple #26
0
 public void TarTest()
 {
     Assert.AreEqual(false, File.Exists(TarFile));
     Helper.StartWorkflow(20);
     Assert.AreEqual(true, File.Exists(TarFile));
 }