/// <summary>
 /// Adds a part to this component
 /// </summary>
 /// <param name="part">Part to add to this component</param>
 public void AddPart(SOPart part)
 {
     if (this.m_Parts == null)
     {
         this.ReInitParts();
     }
     this.m_Parts.Add(part);
 }
        public void TestClear()
        {
            SOComponent component = new SOComponent("0001");

            // Components should not be null
            Assert.NotNull(component.Parts);

            // Components should be empty on the start
            Assert.IsEmpty(component.SubComponents);
            Assert.IsEmpty(component.Parts);

            // Add a subcomponent to the component
            SOComponent subcomponent = new SOComponent("0001");
            component.AddSubComponent(subcomponent);

            // Components should no longer be empty
            Assert.IsNotEmpty(component.SubComponents);
            Assert.AreEqual(1, component.SubComponents.Length);
            Assert.IsInstanceOf(typeof(SOComponent), component.SubComponents[0]);
            Assert.AreEqual(subcomponent, component.SubComponents[0]);

            // Add a part to the component
            SOPart part = new SOPart("0001", new SOMaterial("steel"), 1, "kg");
            component.AddPart(part);

            // Parts should no longer be empty
            Assert.IsNotEmpty(component.Parts);
            Assert.AreEqual(1, component.Parts.Length);
            Assert.IsInstanceOf(typeof(SOPart), component.Parts[0]);
            Assert.AreEqual(part, component.Parts[0]);

            // Clear the component
            component.Clear();

            // Components should be empty
            Assert.IsEmpty(component.SubComponents);

            // Parts should be empty
            Assert.IsEmpty(component.Parts);
        }
 /// <summary>
 /// Adds a part to this component
 /// </summary>
 /// <param name="part">Part to add to this component</param>
 public void AddPart(SOPart part)
 {
     if (this.m_Parts == null) { this.ReInitParts(); }
     this.m_Parts.Add(part);
 }