public virtual void testGetRefElement() { JDFNode n = new JDFDoc("JDF").getJDFRoot(); JDFMedia m = (JDFMedia)n.addResource("Media", null); JDFMedia m1 = (JDFMedia)m.addPartition(EnumPartIDKey.Location, "T1"); JDFMedia m2 = (JDFMedia)m.addPartition(EnumPartIDKey.Location, "T2"); JDFExposedMedia xm = (JDFExposedMedia)n.addResource("ExposedMedia", null); Assert.IsNull(xm.getRefElement(m1)); JDFRefElement re = xm.refElement(m2); Assert.AreEqual(re, xm.getRefElement(m2)); Assert.AreEqual(re, xm.getRefElement(m2)); Assert.AreEqual(xm.getMedia(), m2); Assert.IsNull(xm.getRefElement(m1)); Assert.IsNull(xm.getRefElement(m)); }
public virtual void testGetCreateRefElement() { JDFNode n = new JDFDoc("JDF").getJDFRoot(); JDFMedia m = (JDFMedia)n.addResource("Media", null); JDFMedia m1 = (JDFMedia)m.addPartition(EnumPartIDKey.Location, "T1"); JDFMedia m2 = (JDFMedia)m.addPartition(EnumPartIDKey.Location, "T2"); JDFExposedMedia xm = (JDFExposedMedia)n.addResource("ExposedMedia", null); Assert.IsNull(xm.getRefElement(m1)); for (int i = 0; i < 10; i++) { JDFRefElement re = xm.getCreateRefElement(m2); Assert.AreEqual(re, xm.getRefElement(m2)); Assert.AreEqual(re, xm.getRefElement(m2)); Assert.AreEqual(m2, xm.getMedia()); Assert.IsNull(xm.getRefElement(m1)); Assert.IsNull(xm.getRefElement(m)); Assert.AreEqual(1, xm.numChildElements("MediaRef", null)); } for (int i = 0; i < 10; i++) { JDFRefElement re = xm.getCreateRefElement(m2); Assert.AreEqual(re, xm.getRefElement(m2)); Assert.AreEqual(re, xm.getCreateRefElement(m2)); xm.getCreateRefElement(m); xm.getCreateRefElement(m1); Assert.AreEqual(3, xm.numChildElements("MediaRef", null)); } }