Exemplo n.º 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);
        }
Exemplo n.º 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"));
        }
Exemplo n.º 4
0
 public HttpOptions()
 {
     //defaults
     Method = "get";
     AdditionalOptions = new DynamicHash();
 }
Exemplo n.º 5
0
 public HttpOptions()
 {
     //defaults
     Method            = "get";
     AdditionalOptions = new DynamicHash();
 }
Exemplo n.º 6
0
        public void EmptyHashToString()
        {
            DynamicHash hash = new DynamicHash();

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