Ejemplo n.º 1
0
        public void checkTest1()
        {
            var target = new SevenZipComponent();

            try {
                target.parse("[7z check]");
                Assert.Fail("1");
            }
            catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); }

            try {
                target.parse("[7z check()]");
                Assert.Fail("2");
            }
            catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); }
        }
Ejemplo n.º 2
0
        public void packDirectoryTest1()
        {
            var target = new SevenZipComponent();

            try {
                target.parse("[7z pack.directory(\" \", \"name.zip\")]");
                Assert.Fail("1");
            }
            catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); }

            try {
                target.parse("[7z pack.directory(\"pathtodir\", \" \")]");
                Assert.Fail("2");
            }
            catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); }

            try {
                target.parse("[7z pack.directory(\"dir\")]");
                Assert.Fail("3");
            }
            catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); }

            try {
                target.parse("[7z pack.directory(\"dir\", \"output\", SevenZip)]");
                Assert.Fail("4");
            }
            catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); }

            try {
                target.parse("[7z pack.directory(\"dir\", \"output\").right]");
                Assert.Fail("5");
            }
            catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); }

            try {
                target.parse("[7z pack.directory()]");
                Assert.Fail("6");
            }
            catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); }
        }
Ejemplo n.º 3
0
 public void parseTest1()
 {
     var target = new SevenZipComponent();
     target.parse("[7z NotRealSubtype.check]");
 }
Ejemplo n.º 4
0
        public void packTest1()
        {
            var target = new SevenZipComponent();

            try {
                target.parse("[7z pack]");
                Assert.Fail("1");
            }
            catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); }

            try {
                target.parse("[7z pack files]");
                Assert.Fail("2");
            }
            catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); }

            try {
                target.parse("[7z pack.files()]");
                Assert.Fail("3");
            }
            catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); }
        }
Ejemplo n.º 5
0
        public void packFilesTest2()
        {
            var target = new SevenZipComponent();

            try {
                target.parse("[7z pack.files({}, \"output\")]");
                Assert.Fail("1");
            }
            catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); }

            using(var tf = new TempFile())
            {
                try {
                    target.parse("[7z pack.files({\"" + tf.file + "\", \" \"}, \"output\")]");
                    Assert.Fail("2");
                }
                catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); }

                try {
                    target.parse("[7z pack.files({\" \", \"" + tf.file + "\"}, \"output\")]");
                    Assert.Fail("3");
                }
                catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); }

                try {
                    target.parse("[7z pack.files({\"" + tf.file + "\"}, \" \")]");
                    Assert.Fail("4");
                }
                catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); }
            }

            try {
                target.parse("[7z pack.files({\"thisisreallyisnotreal.file\", \" \"}, \"output\")]");
                Assert.Fail("5");
            }
            catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotFoundException), ex.GetType().ToString()); }

            try {
                target.parse("[7z pack.files({\" \"}, \"output\")]");
                Assert.Fail("6");
            }
            catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); }
        }
Ejemplo n.º 6
0
        public void packFilesTest1()
        {
            var target = new SevenZipComponent();

            try {
                target.parse("[7z pack.files(\"files\", \"output\")]");
                Assert.Fail("1");
            }
            catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); }

            try {
                target.parse("[7z pack.files({\"f1\", 12}, \"output\")]");
                Assert.Fail("2");
            }
            catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); }

            try {
                target.parse("[7z pack.files({\"f1\", \"f2\"}, \"output\", SevenZip)]");
                Assert.Fail("3");
            }
            catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); }

            try {
                target.parse("[7z pack.files({\"f1\"}, \"output\").right]");
                Assert.Fail("4");
            }
            catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); }

            try {
                target.parse("[7z pack.files()]");
                Assert.Fail("5");
            }
            catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); }
        }