public virtual void testAddPhaseTime() { JDFDoc doc = new JDFDoc("JDF"); JDFNode n = doc.getJDFRoot(); JDFAuditPool ap = n.getCreateAuditPool(); JDFProcessRun pr = ap.addProcessRun(EnumNodeStatus.Completed, null, null); JDFPhaseTime pt0 = null; for (int i = 0; i < 10; i++) { JDFPhaseTime pt = ap.addPhaseTime(EnumNodeStatus.InProgress, null, null); if (i == 0) { pt0 = pt; } JDFDate start = new JDFDate(); start.TimeInMillis = start.TimeInMillis + i * 1000 * 1000; pt.setStart(start); JDFDate end = new JDFDate(); end.TimeInMillis = end.TimeInMillis + 100 * 1000 + i * 1000 * 1000; pt.setEnd(end); Assert.AreEqual(100, pt.getDuration().Duration, 1.0); pr.addPhase(pt); Assert.AreEqual((i + 1) * 100, pr.getDuration().Duration, 1.0); if (pt0 != null) { Assert.AreEqual(pr.getStart(), pt0.getStart()); } Assert.AreEqual(pr.getEnd(), pt.getEnd()); } }
public virtual void testGetDuration() { JDFDoc doc = new JDFDoc("JDF"); JDFNode n = doc.getJDFRoot(); JDFAuditPool ap = n.getCreateAuditPool(); JDFProcessRun pt = ap.addProcessRun(EnumNodeStatus.Completed, null, null); pt.setStart(new JDFDate()); JDFDate end = new JDFDate(); end.TimeInMillis = end.TimeInMillis + 100 * 1000; pt.setEnd(end); Assert.AreEqual(100.0, pt.getDuration().Duration, 1.0); pt.setDurationSeconds(50); Assert.AreEqual(50.0, pt.getDuration().Duration, 1.0); }