Example #1
0
        public void TestMkDirAndRMDir()
        {
            // Cleanup
            if (Directory.Exists(testDir))
            {
                Directory.Delete(testDir);
            }

            iModule mod = new WindowsModule();

            string[] args = new string[1];
            args [0] = testDir;

            mod.run("mkdir", args);

            // The return code may indicate
            // the tests are not being run in an environment
            // with bash (Windows, some distros).
            if (mod.resultCode() != 2)
            {
                // Check the directory exists indicating success
                // Double check the return code is the expected 0
                Assert.AreEqual(Directory.Exists(testDir), true);
                Assert.AreEqual(mod.resultCode(), 0);
            }

            args     = new string[3];
            args [0] = "/s";
            args [1] = "/q";
            args [2] = testDir;

            mod.run("rmdir", args);

            // The return code may indicate
            // the tests are not being run in an environment
            // with bash (Windows, some distros).
            if (mod.resultCode() != 2)
            {
                // Check the directory no longer exists indicating success
                // Double check the return code is the expected 0
                Assert.AreEqual(Directory.Exists(testDir), false);
                Assert.AreEqual(mod.resultCode(), 0);
            }
        }
Example #2
0
        public void TestHelpOutput()
        {
            iModule mod = new WindowsModule();

            mod.run("help", new string[0]);

            // The return code may indicate
            // the tests are not being run in an environment
            // with cmd (e.g. Anything but Windows).
            if (mod.resultCode() != 2)
            {
                // Light check just to ensure some related output came back.
                Assert.AreEqual(mod.standardOutput().Contains("HELP"), true);
            }
        }
Example #3
0
        public void TestPingOutput()
        {
            iModule mod = new WindowsModule();

            string[] args = new string[1];
            args[0] = "127.0.0.1";

            mod.run("ping", args);

            // The return code may indicate
            // the tests are not being run in an environment
            // with cmd (e.g. Anything but Windows).
            if (mod.resultCode() != 2)
            {
                // Light check just to ensure some related output came back.
                Assert.AreEqual(mod.standardOutput().Contains("Pinging"), true);
            }
        }