public M4() { Prop1 = new C3(); AddRootComponent(Prop2); AddRootComponents(_c2, _c3); AddRootComponents(Prop1); AddRootComponents(); // should have no effect }
protected override void Check() { var c1 = new C2(); var c2 = new C2(); var c3 = new C3("name"); var c4 = new C2(); var m = new Model(); m.AddRootComponent(c1); m.AddRootComponents(c2, c3); m.AddRootComponents(c4); m.AddRootComponents(); // should have no effect m.Seal(); m.Metadata.RootComponent.Subcomponents.ShouldBe(new[] { c1.Metadata, c2.Metadata, c3.Metadata, c4.Metadata }); m.Metadata.Components.ShouldBe(new[] { m.Metadata.RootComponent, c1.Metadata, c2.Metadata, c3.Metadata, c4.Metadata }); m.Metadata.RootComponent.Subcomponents[0].Name.ShouldBe("c1"); m.Metadata.RootComponent.Subcomponents[1].Name.ShouldBe("c2"); m.Metadata.RootComponent.Subcomponents[2].Name.ShouldBe("name"); m.Metadata.RootComponent.Subcomponents[3].Name.ShouldBe("c4"); }