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"); } }
/// <summary> /// when setting up RTWS, use overload that takes session ID and secret to use WS-Security /// </summary> protected LETSIRTE_Service getClient() { LETSIRTE_Service client = new LETSIRTE_Service(RegId, Secret); client.Url = URL; Debug.WriteLine(URL); return client; }
public void workflow() { LETSIRTE_Service client = getClient(); Log("verify open attempt"); attemptSummary[] attempts = client.GetAttemptList(); if (entry.other == attempts[attempts.Length - 1].entry) { Assert.Ignore(string.Format("Current attempt for registration {0} is closed, registration is closed, test can't continue.", RegId)); } //- set values (suspend) set(exit.suspend); //- clear values (suspend) clear(exit.suspend); //- set values (normal) set(exit.normal); //- get list (verify) VerifyLast(entry.ab_initio, null, client); //- set values (close) set(exit.logout); //- get list (verify) VerifyLast(entry.other, NO_CHECK, client); Log(Environment.NewLine + "Trying to update locked registration, should fail."); try { set(exit.suspend); Assert.Fail("Set should have failed due to locked registration."); } catch (SoapException ex) { Log("Expected failure verified: " + ex.Message); } client = new LETSIRTE_Service(RegId + System.Guid.NewGuid().ToString(), Secret); client.Url = URL; //- get wrong registration (verify fail) Log(Environment.NewLine + "Trying to get attempt list with invalid registration, should fail."); try { client.GetAttemptList(); Assert.Fail("Set should have failed due to wrong registration."); } catch (SoapException ex) { Log("Expected failure verified: " + ex.Message); } }