예제 #1
0
        /// <summary>
        /// Runs the test.
        /// </summary>
        /// <param name="ctx">The php context.</param>
        /// <param name="script">The script content.</param>
        protected virtual void RunTest(TestPhpContext ctx, string script)
        {
            ctx.Eval(script);

            var response = ctx.GetResponse();

            response.Should().ShouldBeEquivalentTo("ok", "Test script should echo 'ok' when passed");
        }
예제 #2
0
        /// <summary>
        /// Runs the test.
        /// </summary>
        /// <param name="name">The resource name containing the php script test.</param>
        /// <exception cref="System.Exception">Invalid or empty script</exception>
        protected void RunTest(string name)
        {
            var script = this.GetTestScriptContent(name);

            script.Should().NotBeNullOrWhiteSpace("Script resource '{0}' is null or empty", name);
            if (string.IsNullOrWhiteSpace(script))
            {
                throw new System.Exception("Invalid or empty script");
            }

            using (var ctx = new TestPhpContext())
            {
                this.RunTest(ctx, script);
            }
        }