public void build_children_to_an_array() { var children = new Instance[] { new SmartInstance <ColorWidget>().Ctor <string>("color").Is("red"), new SmartInstance <ColorWidget>().Ctor <string>("color").Is("green"), new ObjectInstance(new AWidget()) }; var theInstance = new EnumerableInstance(children); var list = theInstance.Build <IWidget[]>(new StubBuildSession()).ShouldBeOfType <IWidget[]>(); list.Length.ShouldEqual(3); list[0].ShouldBeOfType <ColorWidget>().Color.ShouldEqual("red"); list[2].ShouldBeOfType <AWidget>(); }
public void build_children_to_a_list() { var children = new Instance[] { new SmartInstance <ColorWidget>().Ctor <string>("color").Is("red"), new SmartInstance <ColorWidget>().Ctor <string>("color").Is("green"), new ObjectInstance(new AWidget()) }; var theInstance = new EnumerableInstance(children); var list = theInstance.Build <IList <IWidget> >(new StubBuildSession()).As <IList <IWidget> >(); list.Count.ShouldBe(3); list[0].ShouldBeOfType <ColorWidget>().Color.ShouldBe("red"); list[2].ShouldBeOfType <AWidget>(); }
public void build_children_to_a_list() { var children = new Instance[] { new SmartInstance <ColorWidget>().WithCtorArg("color").EqualTo("red"), new SmartInstance <ColorWidget>().WithCtorArg("color").EqualTo("green"), new ObjectInstance(new AWidget()) }; var theInstance = new EnumerableInstance(typeof(IList <IWidget>), children); var list = theInstance.Build(typeof(IList <IWidget>), new StubBuildSession()).ShouldBeOfType <List <IWidget> >(); list.Count.ShouldEqual(3); list[0].ShouldBeOfType <ColorWidget>().Color.ShouldEqual("red"); list[2].ShouldBeOfType <AWidget>(); }