public virtual void testStateReportRequired() { JDFDoc d = new JDFDoc("DevCap"); JDFDevCap dc = (JDFDevCap)d.getRoot(); dc.setName("foo"); JDFIntegerState @is = dc.appendIntegerState(); @is.setName("bar1"); @is.setRequired(true); JDFIntegerState is2 = dc.appendIntegerState(); is2.setName("bar2"); is2.setRequired(false); JDFDoc d2 = new JDFDoc("foo"); KElement foo = d2.getRoot(); JDFDoc d3 = new JDFDoc("parent"); KElement parent = d3.getRoot(); dc.stateReport(foo, EnumFitsValue.Allowed, EnumValidationLevel.Complete, false, true, parent); Assert.IsTrue(parent.ToString().IndexOf("bar1") >= 0); Assert.IsFalse(parent.ToString().IndexOf("bar2") >= 0); }
public void testMinOccurs() { JDFDevCap dc = deviceCap.appendDevCaps().appendDevCap(); JDFIntegerState @is = dc.appendIntegerState(); Assert.AreEqual(1, @is.getMinOccurs(), "default=1"); }
public void testGetAvailability() { JDFDevCap dc = deviceCap.appendDevCaps().appendDevCap(); JDFIntegerState @is = dc.appendIntegerState(); Assert.AreEqual(EnumAvailability.Installed, dc.getAvailability()); Assert.AreEqual(EnumAvailability.Installed, @is.getAvailability()); dc.setAvailability(EnumAvailability.NotLicensed); Assert.AreEqual(EnumAvailability.NotLicensed, dc.getAvailability()); Assert.AreEqual(EnumAvailability.NotLicensed, @is.getAvailability()); }
public void testMaxOccurs() { JDFDevCap dc = deviceCap.appendDevCaps().appendDevCap(); JDFIntegerState @is = dc.appendIntegerState(); Assert.AreEqual(1, @is.getMaxOccurs()); @is.setMaxOccurs(int.MaxValue); Assert.AreEqual(JDFConstants.POSINF, @is.getAttribute(AttributeName.MAXOCCURS, null, null)); Assert.IsTrue(@is.getMaxOccurs() > 999); @is.setAttribute(AttributeName.MAXOCCURS, "unbounded"); Assert.IsTrue(@is.getMaxOccurs() > 999, "correctly parsed unbounded for legacy support"); }
public void testFixVersion() { JDFDevCap dc = deviceCap.appendDevCaps().appendDevCap(); JDFIntegerState @is = dc.appendIntegerState(); Assert.IsNull(@is.getAttribute(AttributeName.MAXOCCURS, null, null)); @is.fixVersion(null); Assert.IsNull(@is.getAttribute(AttributeName.MAXOCCURS, null, null)); @is.setAttribute(AttributeName.MAXOCCURS, "unbounded"); @is.fixVersion(null); Assert.AreEqual(JDFConstants.POSINF, @is.getAttribute(AttributeName.MAXOCCURS)); @is.setAttribute(AttributeName.MAXOCCURS, "3"); @is.fixVersion(null); Assert.AreEqual("3", @is.getAttribute(AttributeName.MAXOCCURS)); }
public virtual void testGetIntegerState() { JDFDoc d = new JDFDoc("DevCap"); JDFDevCap dc = (JDFDevCap)d.getRoot(); JDFIntegerState @is = dc.appendIntegerState("foo"); Assert.AreEqual("foo", @is.getName()); @is = dc.getIntegerState("bar"); Assert.IsNull(@is); @is = dc.getCreateIntegerState("bar"); Assert.IsNotNull(@is); Assert.AreEqual("bar", @is.getName()); @is = dc.getIntegerState("bar"); Assert.IsNotNull(@is); Assert.AreEqual("bar", @is.getName()); }