public void hashTest3()
        {
            FunctionComponent target = new FunctionComponent();

            Assert.AreEqual("ED076287532E86365E841E92BFC50D8C", target.parse("[Func hash.MD5(\"Hello World!\")]"));
            Assert.AreEqual("2EF7BDE608CE5404E97D5F042F95F89F1C232871", target.parse("[Func hash.SHA1(\"Hello World!\")]"));
        }
        public void HashTest6()
        {
            var target = new FunctionComponent(new Soba());

            Assert.Throws <ArgumentException>(() =>
                                              target.Eval("[Func hash.MD5()]")
                                              );

            Assert.Throws <ArgumentException>(() =>
                                              target.Eval("[Func hash.SHA1()]")
                                              );

            Assert.Throws <ArgumentException>(() =>
                                              target.Eval("[Func hash.MD5(test)]")
                                              );

            Assert.Throws <ArgumentException>(() =>
                                              target.Eval("[Func hash.SHA1(test)]")
                                              );

            Assert.Throws <ArgumentException>(() =>
                                              target.Eval("[Func hash.MD5(\"test\", true)]")
                                              );

            Assert.Throws <ArgumentException>(() =>
                                              target.Eval("[Func hash.SHA1(\"test\", true)]")
                                              );
        }
        public void hashTest7()
        {
            FunctionComponent target = new FunctionComponent();

            Assert.AreEqual("D41D8CD98F00B204E9800998ECF8427E", target.parse("[Func hash.MD5(\"\")]"));
            Assert.AreEqual("DA39A3EE5E6B4B0D3255BFEF95601890AFD80709", target.parse("[Func hash.SHA1(\"\")]"));
        }
        public void HashTest7()
        {
            var target = new FunctionComponent(new Soba());

            Assert.Equal("D41D8CD98F00B204E9800998ECF8427E", target.Eval("[Func hash.MD5(\"\")]"));
            Assert.Equal("DA39A3EE5E6B4B0D3255BFEF95601890AFD80709", target.Eval("[Func hash.SHA1(\"\")]"));
        }
        public void ParseTest1()
        {
            var target = new FunctionComponent(new Soba());

            Assert.Throws <SubtypeNotFoundException>(() =>
                                                     target.Eval("[Func NotRealSubtype.check]")
                                                     );
        }
        public void HashTest5()
        {
            var target = new FunctionComponent(new Soba());

            Assert.Throws <NotSupportedOperationException>(() =>
                                                           target.Eval("[Func hash.MD5(\"Hello World!\") = true]")
                                                           );

            Assert.Throws <NotSupportedOperationException>(() =>
                                                           target.Eval("[Func hash.SHA1(\"Hello World!\") = true]")
                                                           );
        }
        public void HashTest2()
        {
            var target = new FunctionComponent(new Soba());

            Assert.Throws <IncorrectNodeException>(() =>
                                                   target.Eval("[Func hash.MD5]")
                                                   );

            Assert.Throws <IncorrectNodeException>(() =>
                                                   target.Eval("[Func hash.SHA1]")
                                                   );
        }
        public void hashTest2()
        {
            var target = new FunctionComponent();

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

            try {
                target.parse("[Func hash.SHA1]");
                Assert.Fail("2");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); }
        }
        public void hashTest5()
        {
            var target = new FunctionComponent();

            try {
                target.parse("[Func hash.MD5(\"Hello World!\") = true]");
                Assert.Fail("1");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); }

            try {
                target.parse("[Func hash.SHA1(\"Hello World!\") = true]");
                Assert.Fail("2");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); }
        }
        public void hashTest6()
        {
            var target = new FunctionComponent();

            try {
                target.parse("[Func hash.MD5()]");
                Assert.Fail("1");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); }

            try {
                target.parse("[Func hash.SHA1()]");
                Assert.Fail("2");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); }

            try {
                target.parse("[Func hash.MD5(test)]");
                Assert.Fail("3");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); }

            try {
                target.parse("[Func hash.SHA1(test)]");
                Assert.Fail("4");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); }

            try {
                target.parse("[Func hash.MD5(\"test\", true)]");
                Assert.Fail("5");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); }

            try {
                target.parse("[Func hash.SHA1(\"test\", true)]");
                Assert.Fail("6");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); }
        }
        public void parseTest1()
        {
            FunctionComponent target = new FunctionComponent();

            target.parse("[Func NotRealSubtype.check]");
        }
Exemple #12
0
 public FunctionComponentWrapper(FunctionComponent component)
 {
     _component = component;
 }