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); }
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 TestClearDesign() { SODesign design = new SODesign("test_design"); SODesignAlternative alternative = new SODesignAlternative("alternative_0001"); design.AddAlternative(alternative); // design should not be null Assert.NotNull(design); // clears the design design.ClearDesign(); // first design alternative should be the default one Assert.IsNotEmpty(design.Alternatives); Assert.AreEqual(1, design.Alternatives.Length); Assert.AreEqual(SODesign.DEFAULT_ALTERNATIVE_NAME, design.Alternatives[0].Name); }
public void TestCurrentAlternative() { SODesign design = new SODesign("test_design"); // design should not be null Assert.NotNull(design); // current alternative should be the first alternative Assert.AreEqual(1, design.Alternatives.Length); Assert.NotNull(design.CurrentAlternative); Assert.AreEqual(SODesign.DEFAULT_ALTERNATIVE_NAME, design.CurrentAlternative.Name); SODesignAlternative alternative = new SODesignAlternative("alternative_0001"); design.AddAlternative(alternative); // current alternative should be the second alternative Assert.AreEqual(2, design.Alternatives.Length); Assert.NotNull(design.CurrentAlternative); Assert.AreEqual("alternative_0001", design.CurrentAlternative.Name); }