public void TestAddParent() { SOParametricComponent component1 = new MockSOComponent("test_0001"); SOParametricComponent component2 = new MockSOComponent("test_0002"); // component should not be null Assert.NotNull(component1); Assert.NotNull(component2); // Parents should have zero items Assert.IsEmpty(component1.Parents); Assert.IsEmpty(component2.Parents); // component should now have a parent component2.AddParent(component1); // component2 should have 1 item in Parents Assert.IsEmpty(component1.Parents); Assert.AreEqual(1, component2.Parents.Length); Assert.AreEqual(component1, component2.Parents[0]); // clear parents component2.ClearParents(); // Parents should have zero items Assert.IsEmpty(component1.Parents); Assert.IsEmpty(component2.Parents); }
public void TestAddChild() { SOParametricComponent component1 = new MockSOComponent("test_0001"); SOParametricComponent component2 = new MockSOComponent("test_0002"); // component should not be null Assert.NotNull(component1); Assert.NotNull(component2); // Children should have zero items Assert.IsEmpty(component1.Children); Assert.IsEmpty(component2.Children); // component should now have a child component2.AddChild(component1); // component2 should have 1 item in Children Assert.IsEmpty(component1.Children); Assert.AreEqual(1, component2.Children.Length); Assert.AreEqual(component1, component2.Children[0]); // clear children component2.ClearChildren(); // Parents should have zero items Assert.IsEmpty(component1.Children); Assert.IsEmpty(component2.Children); }
public void TestGuid() { string guid = "ThisIsAGuid"; SOParametricComponent component = new MockSOComponent("test_0001"); // component should not be null Assert.NotNull(component); // you should be able to set the guid component.GUID = guid; // the GUID property should be the same as the guid Assert.AreEqual(guid, component.GUID); }