protected void SetUp()
{
provider = new TestProvider();
al = provider.Customers;
h = new System.Collections.Hashtable();
SupportClass.PutElement(h, "Bar", "this is from a hashtable!");
SupportClass.PutElement(h, "Foo", "this is from a hashtable too!");
/*
* lets set up a vector of objects to test late introspection. See ASTMethod.java
*/
vec = new System.Collections.ArrayList();
vec.Add(new System.String("string1".ToCharArray()));
vec.Add(new System.String("string2".ToCharArray()));
/*
* set up 3 chained contexts, and add our data
* throught the 3 of them.
*/
context2 = new VelocityContext();
context1 = new VelocityContext(context2);
context = new VelocityContext(context1);
context.Put("provider", provider);
context1.Put("name", "jason");
context2.Put("providers", provider.Customers2);
context.Put("list", al);
context1.Put("hashtable", h);
context2.Put("hashmap", new Hashtable());
context2.Put("search", provider.Search);
context.Put("relatedSearches", provider.RelSearches);
context1.Put("searchResults", provider.RelSearches);
context2.Put("stringarray", provider.Array);
context.Put("vector", vec);
context.Put("mystring", new System.String("".ToCharArray()));
context.Put("runtime", new FieldMethodizer("NVelocity.Runtime.RuntimeSingleton"));
context.Put("fmprov", new FieldMethodizer(provider));
context.Put("Floog", "floogie woogie");
context.Put("boolobj", new BoolObj());
/*
* we want to make sure we test all types of iterative objects
* in #foreach()
*/
System.Object[] oarr = new System.Object[] { "a", "b", "c", "d" };
int[] intarr = new int[] { 10, 20, 30, 40, 50 };
context.Put("collection", vec);
context2.Put("iterator", vec.GetEnumerator());
context1.Put("map", h);
context.Put("obarr", oarr);
context.Put("enumerator", vec.GetEnumerator());
context.Put("intarr", intarr);
}