public void GetLocalContext() { BindingEnvironment global = new BindingEnvironment(); BindingEnvironment local = new BindingEnvironment(global); ContextFunction function = new ContextFunction("locals", false); var result = function.Apply(local, null, null); Assert.IsNotNull(result); Assert.AreEqual(local, result); Assert.IsFalse(function.IsGlobal); Assert.AreEqual("locals", function.Name); }
public void RaiseWhenTwoParameters() { ContextFunction function = new ContextFunction("locals", false); try { function.Apply(null, new object[] { 1, 2 }, null); Assert.Fail("Exception expected"); } catch (Exception ex) { Assert.IsInstanceOfType(ex, typeof(TypeError)); Assert.AreEqual("locals() takes no arguments (2 given)", ex.Message); } }