public void RaiseIfOddNumberOfLetBindingArguments()
 {
     LetPrimitive letprim = new LetPrimitive();
     letprim.Apply(null, null, new object[] { new object[] { "x", 1, "y" } });
 }
 public void RaiseIfLetBindingArgumentIsNotACollection()
 {
     LetPrimitive letprim = new LetPrimitive();
     letprim.Apply(null, null, new object[] { 123 });
 }
        public void EvaluateLetWithTwoBindings()
        {
            LetPrimitive letprim = new LetPrimitive();
            Machine machine = new Machine();

            object result = letprim.Apply(machine, machine.Environment, new object[] { new object[] { Symbol.Create("x"), 1, Symbol.Create("y"), Symbol.Create("x") }, Symbol.Create("y") });

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(int));
            Assert.AreEqual(1, result);
        }
 public void RaiseIfInvalidNameInLetArguments()
 {
     LetPrimitive letprim = new LetPrimitive();
     letprim.Apply(new Machine(), null, new object[] { new object[] { "x", 1, "y", 2, 3, 4 } });
 }
        public void EvaluateLetWithSimpleBinding()
        {
            LetPrimitive letprim = new LetPrimitive();
            Machine machine = new Machine();

            object result = letprim.Apply(machine, machine.Environment, new object[] { new object[] { Symbol.Create("foo"), "bar" }, Symbol.Create("foo") });

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(string));
            Assert.AreEqual("bar", result);
        }