public void TestComponents() { SODesignAlternative alternative = new SODesignAlternative("default"); // Components should not be null Assert.NotNull(alternative.Components); // Components should be empty on the start Assert.IsEmpty(alternative.Components); // Add a component SOComponent component = new SOComponent("default"); alternative.AddComponent(component); // Components should no longer be empty Assert.IsNotEmpty(alternative.Components); Assert.AreEqual(1, alternative.Components.Length); // Component should match Assert.AreEqual(component, alternative.Components[0]); // Clear the components alternative.ClearComponents(); // Components should be empty on the start Assert.IsEmpty(alternative.Components); }
public void TestFlattenedComponents() { SODesignAlternative alternative = new SODesignAlternative("default"); // Components should not be null Assert.NotNull(alternative.Components); // Components should be empty on the start Assert.IsEmpty(alternative.Components); // Add a component SOComponent component1 = new SOComponent("0001"); SOComponent component2 = new SOComponent("0002"); SOComponent component3 = new SOComponent("0003"); SOComponent component4 = new SOComponent("0004"); SOComponent component5 = new SOComponent("0005"); alternative.AddComponent(component1); component1.AddSubComponent(component2); component2.AddSubComponent(component3); component1.AddSubComponent(component4); alternative.AddComponent(component5); // FlattenedComponents should contain a list of 5 components now Assert.IsNotEmpty(alternative.FlattenedComponents); Assert.AreEqual(5, alternative.FlattenedComponents.Length); }