public StoreStatements ( RusticiSoftware.TinCanAPILibrary.Model.Statement statements ) : void | ||
statements | RusticiSoftware.TinCanAPILibrary.Model.Statement | An array of statements to store |
Résultat | void |
public static void JSObject() { Console.WriteLine("Start\n\n"); //TCAPI tincan = new TCAPI(new Uri("http://35.9.22.105:8000/xapi"), new BasicHTTPAuth("Dave", "12345")); Statement[] statements = new Statement[1]; Activity newAct = new Activity("http://www.google.com"); newAct.Definition = new ActivityDefinition(); newAct.Definition.Name = new LanguageMap(); newAct.Definition.Name.Add("en-US", "Testing"); statements[0] = new Statement(new Actor("Guess Who", "mailto:guesswho"), new StatementVerb(PredefinedVerbs.Created), newAct); TCAPI tincan = new TCAPI(new Uri("http://35.9.22.105:8000/xapi"), new BasicHTTPAuth("Joe", "123"), RusticiSoftware.TinCanAPILibrary.Helper.TCAPIVersion.TinCan1p0p0); tincan.StoreStatements(statements); Console.WriteLine("End\n"); }
/// <summary> ///A test for StoreStatement ///</summary> /// //[TestMethod()] public void StoreStatementTest() { TCAPI target = new TCAPI("http://cloud.scorm.com/ScormEngineInterface/TCAPI/public", new BasicHTTPAuth("test", "password")); target.MaxBatchSize = 1; Statement[] statements = new Statement[1]; TinCanActivity activity = new TinCanActivity("http://www.example.com"); activity.Definition = new ActivityDefinition(); activity.Definition.Name = new LanguageMap(); activity.Definition.Name.Add("en-US", "TCAPI C# 0.95 Library."); statements[0] = new Statement(new Actor("Example", "mailto:[email protected]"), new StatementVerb(PredefinedVerbs.Experienced), activity); target.StoreStatements(statements); Assert.Inconclusive(INCONCLUSIVE); }
/// <summary> ///A test for StoreStatements ///</summary> //[TestMethod()] public void StoreStatementsAsyncTest() { TCAPI target = new TCAPI("https://cloud.scorm.com/ScormEngineInterface/TCAPI/CZSWMUZPSE", new BasicHTTPAuth("CZSWMUZPSE", "vwiuflgsY22FDXpHA4lwwe5hrnUXvcyJjW3fDrpH"), new TCAPICallback(), new OfflineStorage(), 750, 2); Statement[] statements = new Statement[6]; for (int i = 0; i < statements.Length; i++) { int j = i % 3; switch (j) { case 0: statements[i] = new Statement(new Actor("Mufasa", "mailto:[email protected]"), new StatementVerb(PredefinedVerbs.Experienced), new TinCanActivity("test activity")); break; case 1: statements[i] = new Statement(new Actor("Carl", "mailto:[email protected]"), new StatementVerb(PredefinedVerbs.Experienced), new TinCanActivity("TinCanClientLibrary")); break; case 2: statements[i] = new Statement(new Actor("DiBiase", "mailto:[email protected]"), new StatementVerb(PredefinedVerbs.Experienced), new TinCanActivity("test activity")); break; } } target.StoreStatements(statements, false); //target.Flush(); Statement[] statementSize; while ((statementSize = target.OfflineStorage.GetQueuedStatements(1)) != null && (statementSize.Length > 0)) { Thread.Sleep(500); Console.WriteLine("Waiting"); } target.Dispose(); // Releases the thread timer handle // If all statements successfully flush out of the buffer AND no exceptions are thrown (which should repopulate the buffer) // then the test was successful and the final statementSize should be null, indicating an empty queue. // The default implementation returns a null object. However you may also return a size-0 array, all checks ensure both. Assert.IsTrue(statementSize == null || statementSize.Length == 0); }