Beispiel #1
0
        public void TestProcessWithError()
        {
            var parameterProvider = new TestParameterProvider();
            var formEngine        = new FormEngine(parameterProvider, null, new ClientSideFormPersister(), new SimpleErrorHandler(new DefaultMethodInvoker()));

            parameterProvider.Add("eventHandler", "ErroneousEvent");
            var form = new MyForm {
                Id = "formId"
            };

            parameterProvider.Add("state", Convert.ToBase64String(SerializationUtils.SerializeObject(form)));
            parameterProvider.Add("EVT.srcId", "formId.testSrcId");
            parameterProvider.Add("EVT.someParameter", "testParameter");

            var expr = formEngine.DoProcess();

            Assert.IsTrue(expr.Encode().StartsWith("alert(\"some error\")"));
        }
Beispiel #2
0
        public void TestProcess()
        {
            var parameterProvider = new TestParameterProvider();

            parameterProvider.Add("eventHandler", "SuccessfulEvent");
            var formEngine = new FormEngine(parameterProvider, null, new ClientSideFormPersister(), new DefaultMethodInvoker());
            var form       = new MyForm {
                Id = "formId"
            };

            parameterProvider.Add("state", Convert.ToBase64String(SerializationUtils.SerializeObject(form)));
            parameterProvider.Add("EVT.srcId", "formId.testSrcId");
            parameterProvider.Add("EVT.someParameter", "testParameter");
            var expr = formEngine.DoProcess();

            form.Output = "testSrcId/testParameter";
            Assert.AreEqual("$$('formId').jasty(\"Form\", \"update\", [\"" +
                            Convert.ToBase64String(SerializationUtils.SerializeObject(form)) + "\"]);", expr.Encode());
        }