public GetActivityStateIds ( string activityId, RusticiSoftware.TinCanAPILibrary.Model.Actor actor ) : string[] | ||
activityId | string | The activity ID |
actor | RusticiSoftware.TinCanAPILibrary.Model.Actor | The actor |
return | string[] |
/// <summary> /// Test to ensure ETag collisions are not ignored. /// </summary> //[TestMethod()] public void CollisionTest() { TinCanJsonConverter converter = new TinCanJsonConverter(); TCAPI target = new TCAPI("https://cloud.scorm.com/ScormEngineInterface/TCAPI/CZSWMUZPSE", new BasicHTTPAuth("CZSWMUZPSE", "vwiuflgsY22FDXpHA4lwwe5hrnUXvcyJjW3fDrpH")); Actor actor = new Actor("Mufasa", "mailto:[email protected]"); string[] stateIds = { "The Lion King", "The Fallen King", "The New King" }; string[] stateContents = { "Mufasa rules his country as a proud and fair king of lions, celebrating his recently newborn son Simba.", "Scar kills Mufasa, simply muttering the words 'Long Live the King'", "Simba finally realizes he must follow in his fathers footsteps to save the kingdom from the evil Scar." }; string activityId = "example.com/TheLionKing"; string[] results = target.GetActivityStateIds(activityId, actor); ActivityState state = new ActivityState(activityId, stateIds[0], actor, stateContents[1], "text/plain"); ActivityState previous = new ActivityState(activityId, stateIds[0], actor, stateContents[0], "text/plain"); target.SaveActivityState(state); state.Body = stateContents[2]; target.SaveActivityState(state, false, previous); }
/// <summary> ///A test for GetActivityStateIds ///</summary> //[TestMethod()] public void GetActivityStateIdsTest() { TinCanJsonConverter converter = new TinCanJsonConverter(); TCAPI target = new TCAPI("http://cloud.scorm.com/ScormEngineInterface/TCAPI/public", new BasicHTTPAuth("test", "password")); Actor actor = new Actor("Example", "mailto:[email protected]"); string activityId = "example.com"; string registrationId = null; NullableDateTime since = null; string[] actual; actual = target.GetActivityStateIds(activityId, actor, registrationId, since); Console.Write(converter.SerializeToJSON(actual)); Assert.Inconclusive(INCONCLUSIVE_CONSOLE); }
public void ActivityStateTest() { TinCanJsonConverter converter = new TinCanJsonConverter(); TCAPI target = new TCAPI(new Uri("http://cloud.scorm.com/tc/public"), new BasicHTTPAuth("CZSWMUZPSE", "vwiuflgsY22FDXpHA4lwwe5hrnUXvcyJjW3fDrpH")); Actor actor = new Actor("Mufasa", "mailto:[email protected]"); string[] stateIds = { "The Lion King", "The Fallen King", "The New King" }; string[] stateContents = { "Mufasa rules his country as a proud and fair king of lions, celebrating his recently newborn son Simba.", "Scar kills Mufasa, simply muttering the words 'Long Live the King'", "Simba finally realizes he must follow in his fathers footsteps to save the kingdom from the evil Scar." }; string activityId = "example.com/TheLionKing"; string[] results = target.GetActivityStateIds(activityId, actor); //Assert.AreEqual(0, results.Length); ActivityState state = new ActivityState(); state.ActivityId = activityId; state.Actor = actor; state.StateId = stateIds[0]; state.Body = stateContents[0]; ActivityState previous = new ActivityState(); previous.ActivityId = activityId; previous.Actor = actor; previous.StateId = stateIds[0]; previous.Body = stateContents[0]; target.SaveActivityState(state, false, previous); //target.SaveActivityState(state); state.StateId = stateIds[1]; state.Body = stateContents[1]; target.SaveActivityState(state); state.StateId = stateIds[2]; state.Body = stateContents[2]; target.SaveActivityState(state); results = target.GetActivityStateIds(activityId, actor); Assert.AreEqual(3, results.Length); ActivityState asResult = target.GetActivityState(activityId, actor, stateIds[0]); Assert.AreEqual(stateContents[0], asResult.Body); asResult = target.GetActivityState(activityId, actor, stateIds[0]); asResult = target.GetActivityState(activityId, actor, stateIds[1]); Assert.AreEqual(stateContents[1], asResult.Body); asResult = target.GetActivityState(activityId, actor, stateIds[2]); Assert.AreEqual(stateContents[2], asResult.Body); /* target.DeleteActivityState(activityId, actor, stateIds[0]); results = target.GetActivityStateIds(activityId, actor); Assert.AreEqual(2, results.Length); target.DeleteActivityState(activityId, actor, stateIds[1]); target.DeleteActivityState(activityId, actor, stateIds[2]); */ results = target.GetActivityStateIds(activityId, actor); }