public void FastExpandoCanBeCreatedFromObject() { FastExpando o = FastExpando.FromObject(new { Id = 1, Text = "foo" }); dynamic d = o; Assert.AreEqual(4, o.Count()); Assert.AreEqual(1, d["ID"]); Assert.AreEqual("foo", d["Text"]); }
public void FastExpandoCanExpandByObject() { FastExpando o = FastExpando.FromObject(new { Id = 1, Text = "foo" }); o.Expand(new { Id = 2, Guest = "boo" }); dynamic d = o; Assert.AreEqual(6, o.Count()); Assert.AreEqual(2, d["ID"]); Assert.AreEqual("foo", d["Text"]); Assert.AreEqual("boo", d["GUEST"]); }
public void FastExpandoCanBeUsedAsDynamic() { dynamic d = FastExpando.FromObject(new { Id = 1, Text = "foo" }); d["Property"] = "prop"; d.Expand(new { Id = 2, Guest = "boo" }); FastExpando o = (FastExpando)d; Assert.AreEqual(7, o.Count()); Assert.AreEqual(2, d["ID"]); Assert.AreEqual("foo", d["Text"]); Assert.AreEqual("prop", d["Property"]); }