Beispiel #1
0
        public void FilesEncryptorTest()
        {
            var files = GetFiles(FilesEncryptorFolder);

            Assert.AreEqual(0, files.Length);
            Helper.StartWorkflow(81);
            files = GetFiles(FilesEncryptorFolder);
            Assert.AreEqual(3, files.Length);
            files = GetFiles(FilesDecryptorSrcFolder);
            Assert.AreEqual(3, files.Length);
        }
Beispiel #2
0
 public void HttpPostTest()
 {
     // TODO
     //var files = GetFiles();
     //Assert.AreEqual(0, files.Length);
     Helper.StartWorkflow(100);
     //files = GetFiles();
     //Assert.AreEqual(2, files.Length);
     //Assert.IsTrue(File.Exists(File1));
     //Assert.IsTrue(File.Exists(File2));
 }
Beispiel #3
0
        public void JsonToYamlTest()
        {
            var files = GetFiles();

            Assert.AreEqual(0, files.Length);
            Helper.StartWorkflow(111);
            files = GetFiles();
            Assert.AreEqual(2, files.Length);
            Assert.IsTrue(File.Exists(File1));
            Assert.IsTrue(File.Exists(File2));
        }
Beispiel #4
0
        public void Sha1Test()
        {
            string[] files = GetFiles();
            Assert.AreEqual(0, files.Length);
            Helper.StartWorkflow(46);
            files = GetFiles();
            Assert.AreEqual(1, files.Length);
            string content = File.ReadAllText(files[0]);

            Assert.AreEqual(ExpectedResult, content);
        }
Beispiel #5
0
        public void ProcessInfoTest()
        {
            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);
        }
Beispiel #6
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);
        }
Beispiel #7
0
        public void FilesEqualTest()
        {
            Helper.StartWorkflow(70);

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

            string content = File.ReadAllText(files[0]);

            Assert.AreEqual(ExpectedResult, content);
        }
Beispiel #8
0
        public void FolderExistsTest()
        {
            Stopwatch stopwatch = Stopwatch.StartNew();

            Helper.StartWorkflow(121);
            stopwatch.Stop();
            Assert.IsTrue(stopwatch.ElapsedMilliseconds > 1000);
            stopwatch.Reset();
            stopwatch.Start();
            Helper.StartWorkflow(122);
            stopwatch.Stop();
            Assert.IsTrue(stopwatch.ElapsedMilliseconds > 2000);
        }
Beispiel #9
0
        public void FileMatchTest()
        {
            Stopwatch stopwatch = Stopwatch.StartNew();

            Helper.StartWorkflow(92);
            stopwatch.Stop();
            Assert.IsTrue(stopwatch.ElapsedMilliseconds > 1000);
            stopwatch.Reset();
            stopwatch.Start();
            Helper.StartWorkflow(93);
            stopwatch.Stop();
            Assert.IsTrue(stopwatch.ElapsedMilliseconds > 2000);
        }
Beispiel #10
0
        public void FileExistsTest()
        {
            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);
        }
Beispiel #11
0
 public void CsvToSqlTest()
 {
     string[] files = GetSqlScripts();
     Assert.AreEqual(0, files.Length);
     Helper.StartWorkflow(76);
     files = GetSqlScripts();
     Assert.AreEqual(2, files.Length);
     foreach (var file in files)
     {
         string content = File.ReadAllText(file);
         Assert.AreEqual(ExpectedResult, content);
     }
 }
Beispiel #12
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);
        }
Beispiel #13
0
        public void ExecVbTest()
        {
            var files = GetFiles();

            Assert.AreEqual(0, files.Length);
            Helper.StartWorkflow(99);
            files = GetFiles();
            Assert.AreEqual(4, files.Length);
            Assert.IsTrue(File.Exists(File1));
            Assert.IsTrue(File.Exists(File2));
            Assert.IsTrue(File.Exists(Program1));
            Assert.IsTrue(File.Exists(Program2));
        }
Beispiel #14
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);
        }
Beispiel #15
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);
            }
        }
Beispiel #16
0
        public void Execute(int workflowId, string expectedResult)
        {
            TestInitialize(workflowId);
            Helper.StartWorkflow(workflowId);

            // Check the workflow result
            string[] files = Directory.GetFiles(
                Path.Combine(Helper.TempFolder, workflowId.ToString()),
                "ListFiles*.xml",
                SearchOption.AllDirectories);
            Assert.AreEqual(1, files.Length);

            string content = File.ReadAllText(files[0]);

            Assert.AreEqual(expectedResult, content);
        }
Beispiel #17
0
        public void ImagesConcatTest()
        {
            var images = GetFiles();

            Assert.AreEqual(0, images.Length);
            Helper.StartWorkflow(77);
            images = GetFiles();
            Assert.AreEqual(1, images.Length);

            // Checking the image size
            using (Image image = Image.FromFile(images[0]))
            {
                Assert.AreEqual(3072, image.Width);
                Assert.AreEqual(768, image.Height);
            }
        }
Beispiel #18
0
        public void FtpTest()
        {
            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
        }
Beispiel #19
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));
            }
        }
Beispiel #20
0
        public void SqlTest()
        {
            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
        }
        public void EnvironmentVariableTest()
        {
            Stopwatch stopwatch = Stopwatch.StartNew();

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

            string varValue = Environment.GetEnvironmentVariable("OS");

            switch (varValue)
            {
            case "Windows_NT":
                Assert.IsTrue(stopwatch.ElapsedMilliseconds > 1000);
                break;

            default:
                Assert.IsTrue(stopwatch.ElapsedMilliseconds > 2000);
                break;
            }
        }
Beispiel #22
0
        public void DisapprovalTest()
        {
            var workflowId = 126;
            var instanceId = Helper.StartWorkflow(workflowId);

            Thread.Sleep(500);
            Helper.DisapproveWorkflow(workflowId, instanceId);
            Stopwatch stopwatch = Stopwatch.StartNew();
            var       workflow  = Helper.GetWorkflow(workflowId);
            var       isRunning = workflow.IsRunning;

            while (isRunning)
            {
                Thread.Sleep(100);
                workflow  = Helper.GetWorkflow(workflowId);
                isRunning = workflow.IsRunning;
            }
            stopwatch.Stop();
            Assert.IsTrue(stopwatch.ElapsedMilliseconds > 3000);
        }
Beispiel #23
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);
        }
Beispiel #24
0
        public void NowTest()
        {
            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;
            }
        }
Beispiel #25
0
        public void FilesJoinerTest()
        {
            var files = Directory.GetFiles(SourceFilesFolder);

            Assert.AreEqual(16, files.Length);

            Helper.StartWorkflow(140);

            files = Directory.GetFiles(TempFolder, "*", SearchOption.AllDirectories).OrderBy(f => f).ToArray();
            Assert.AreEqual(4, files.Length);

            var content = File.ReadAllText(files[0]);

            Assert.AreEqual(ExpectedResultFileA, content);

            content = File.ReadAllText(files[1]);
            Assert.AreEqual(ExpectedResultFileB, content);

            content = File.ReadAllText(files[2]);
            Assert.AreEqual(ExpectedResultFileC, content);

            content = File.ReadAllText(files[3]);
            Assert.AreEqual(ExpectedResultFileD, content);
        }
Beispiel #26
0
 public void SevenZipTest()
 {
     Assert.AreEqual(false, File.Exists(SevenZipFile));
     Helper.StartWorkflow(89);
     Assert.AreEqual(true, File.Exists(SevenZipFile));
 }
Beispiel #27
0
 public void TwitterTest()
 {
     Helper.StartWorkflow(16);
     // TODO
 }
Beispiel #28
0
 public void HttpPutTest()
 {
     Helper.StartWorkflow(101);
     // TODO
 }
Beispiel #29
0
 public void CsvToSqlTest()
 {
     // TODO
     Helper.StartWorkflow(144);
 }
Beispiel #30
0
 public void TgzTest()
 {
     Assert.AreEqual(false, File.Exists(TgzFile));
     Helper.StartWorkflow(21);
     Assert.AreEqual(true, File.Exists(TgzFile));
 }