Tests.Tests.TestExternalBinding C# (CSharp) Method

TestExternalBinding() private method

private TestExternalBinding ( ) : void
return void
        public void TestExternalBinding()
        {
            var story = CompileString(@"
EXTERNAL message(x)
EXTERNAL multiply(x,y)
EXTERNAL times(i,str)
~ message(""hello world"")
{multiply(5.0, 3)}
{times(3, ""knock "")}
");
            string message = null;

            story.BindExternalFunction("message", (string arg) =>
            {
                message = "MESSAGE: " + arg;
            });

            story.BindExternalFunction("multiply", (float arg1, int arg2) =>
            {
                return arg1 * arg2;
            });

            story.BindExternalFunction("times", (int numberOfTimes, string str) =>
            {
                string result = "";
                for (int i = 0; i < numberOfTimes; i++)
                {
                    result += str;
                }
                return result;
            });

            Assert.AreEqual("15\n", story.Continue());

            Assert.AreEqual("knock knock knock \n", story.Continue());

            Assert.AreEqual("MESSAGE: hello world", message);
        }
Tests