public void Check_Named_Parameters() { dynamic model = new ElasticObject(); var c1 = model.@class(new { name = "Class1" }); c1.property(new { name = "Property1", type = "string" }); c1.property(new { name = "Property2", type = "string" }); var c2 = model.@class(new { name = "Class2" }); c2.property(new { name = "Property1", type = "string" }); c2.property(new { name = "Property2", type = "string" }); Assert.AreEqual(model["class"].Count, 2); Assert.AreEqual(model["class"][0]["property"].Count, 2); }
public void Check_Nested_Objects_Traversing() { dynamic model = new ElasticObject(); var c1 = model.@class(); c1.name = "Class1"; var p = c1.property(); p.name = "Property1"; p.type = "string"; p = c1.property(); p.name = "Property1"; p.type = "string"; var c2 = model.@class(); p = c2.property(); c2.name = "Class2"; p.name = "Property1"; p.type = "string"; p = c2.property(); p.name = "Property1"; p.type = "string"; Assert.AreEqual(model["class"].Count,2); Assert.AreEqual(model["class"][0]["property"].Count,2); }