private void clear(exit exitValue) { Log(Environment.NewLine + "performing current attempt clear, exit: " + exitValue + Environment.NewLine); LETSIRTE_Service client = getClient(); cocdType cmi = client.Get(); int expectedLength = cmi.attemptNumber; cmi.progressMeasure = null; cmi.progressMeasureSpecified = true; cmi.completionStatus = completionStatusType.unknown; cmi.completionStatusSpecified = true; cmi.successStatus = successStatusType.unknown; cmi.successStatusSpecified = true; cmi.scoreScaled = null; cmi.scoreScaledSpecified = true; cmi.exit = exitValue; cmi.exitSpecified = true; client.Set(cmi); attemptSummary[] attempts = client.GetAttemptList(); foreach (attemptSummary att in attempts) { Log(att.ToString()); } //Did we create a new attempt? Boolean exitCreatedNewAttempt = (exitValue == exit.normal || exitValue == exit.Item); expectedLength += (exitCreatedNewAttempt ? 1 : 0); Assert.AreEqual(expectedLength, attempts.Length); attemptSummary latest = attempts[attempts.Length - (1 + (exitCreatedNewAttempt ? 1 : 0))]; Assert.AreEqual(cmi.scoreScaled, latest.scoreScaled); Assert.AreEqual(cmi.successStatus, latest.successStatus); Assert.AreEqual(cmi.completionStatus, latest.completionStatus); Assert.AreEqual(cmi.progressMeasure, latest.progressMeasure); Assert.AreEqual(exitValue == exit.suspend ? entry.resume : entry.other, latest.entry); Log("verified clear"); }
private void VerifyLast(entry entryType, decimal?scoreScaled, LETSIRTE_Service client) { if (scoreScaled != NO_CHECK) { Log(string.Format("Verifying last attempt has entry: {0} and scaled score: {1}", entryType, scoreScaled)); } else { Log(string.Format("Verifying last attempt has entry: {0}", entryType)); } attemptSummary[] attempts = client.GetAttemptList(); attemptSummary summary = attempts[attempts.Length - 1]; Assert.AreEqual(entryType, summary.entry, "Latest attempt entry did not match"); if (scoreScaled != NO_CHECK) { Assert.AreEqual(scoreScaled, summary.scoreScaled, "Latest attempt score scaled did not match"); } }