Beispiel #1
0
        public object Evaluate(Context context)
        {
            IDictionary result = new DynamicHash();

            for (var k = 0; k < this.keyexpressions.Count; k++)
            {
                result[this.keyexpressions[k].Evaluate(context)] = this.valueexpressions[k].Evaluate(context);
            }

            return(result);
        }
        public void GetIndexedDictionaryEntryAsNil()
        {
            Machine machine = new Machine();
            var     hash    = new DynamicHash();

            hash[new Symbol("one")] = 1;
            hash[new Symbol("two")] = 2;

            IndexedExpression expression = new IndexedExpression(new ConstantExpression(hash), new ConstantExpression(new Symbol("three")));

            var result = expression.Evaluate(machine.RootContext);

            Assert.IsNull(result);
        }
Beispiel #3
0
        public void HashToString()
        {
            DynamicHash hash = new DynamicHash();

            hash[new Symbol("one")] = 1;
            hash[new Symbol("two")] = 2;

            var result = hash.ToString();

            Assert.IsTrue(result.StartsWith("{"));
            Assert.IsTrue(result.EndsWith("}"));
            Assert.IsTrue(result.Contains(":one=>1"));
            Assert.IsTrue(result.Contains(":two=>2"));
        }
Beispiel #4
0
 public HttpOptions()
 {
     //defaults
     Method = "get";
     AdditionalOptions = new DynamicHash();
 }
Beispiel #5
0
 public HttpOptions()
 {
     //defaults
     Method            = "get";
     AdditionalOptions = new DynamicHash();
 }
Beispiel #6
0
        public void EmptyHashToString()
        {
            DynamicHash hash = new DynamicHash();

            Assert.AreEqual("{}", hash.ToString());
        }