AjTalk.Tests.EvaluateTests.CreateAndInvokeAgent C# (CSharp) Method

CreateAndInvokeAgent() private method

private CreateAndInvokeAgent ( ) : void
return void
        public void CreateAndInvokeAgent()
        {
            ManualResetEvent handle = new ManualResetEvent(false);
            Thread thread = null;

            object aclass = this.Evaluate("nil agent: #Agent");

            Assert.IsNotNull(aclass);
            Assert.IsInstanceOfType(aclass, typeof(IBehavior));

            IBehavior behavior = (IBehavior)aclass;

            behavior.DefineInstanceMethod(new FunctionalMethod("sethandle", null, (self, receiver, args) => { thread = Thread.CurrentThread;  return handle.Set(); }));

            object result = this.Evaluate("Agent basicNew sethandle");

            handle.WaitOne();
            Assert.IsNull(result);
            Assert.IsNotNull(thread);
            Assert.AreNotSame(Thread.CurrentThread, thread);
        }
EvaluateTests