/// <summary> ///A test for GetStatements ///</summary> //[TestMethod()] public void GetStatementsTest() { TinCanJsonConverter converter = new TinCanJsonConverter(); TCAPI target = new TCAPI("http://cloud.scorm.com/ScormEngineInterface/TCAPI/public", new BasicHTTPAuth("test", "password"), TCAPIVersion.TinCan090); StatementQueryObject queryObject = new StatementQueryObject(); queryObject.Actor = new Actor("Example", "mailto:[email protected]"); StatementResult actual; actual = target.GetStatements(queryObject); Console.Write(converter.SerializeToJSON(actual)); while (!String.IsNullOrEmpty(actual.More)) { actual = target.GetStatements(actual.More); Console.Write(converter.SerializeToJSON(actual)); //break; } Assert.Inconclusive(INCONCLUSIVE_CONSOLE); }
/// <summary> /// Retreives all statements based matched by the query /// </summary> /// <param name="queryObject">Object to create a statement query with</param> /// <returns>A StatementResult with all the statements</returns> public StatementResult GetStatements(StatementQueryObject queryObject) { NameValueCollection nvc = queryObject.ToNameValueCollection(version); string resultAsJSON = HttpMethods.GetRequest(nvc, endpoint + STATEMENTS, authentification, versionString); TinCanJsonConverter converter = new TinCanJsonConverter(); StatementResult result = null; switch (version) { case TCAPIVersion.TinCan095: result = (StatementResult)converter.DeserializeJSON(resultAsJSON, typeof(StatementResult)); break; case TCAPIVersion.TinCan090: result = (StatementResult)((Model.TinCan090.StatementResult)converter.DeserializeJSON(resultAsJSON, typeof(Model.TinCan090.StatementResult))); break; } return result; }
public void GetStatementsTest() { TinCanJsonConverter converter = new TinCanJsonConverter(); TCAPI target = new TCAPI(new Uri("http://cloud.scorm.com/tc/public"), new BasicHTTPAuth("test", "password"), TCAPIVersion.TinCan095); StatementQueryObject queryObject = new StatementQueryObject(); queryObject.Actor = new Actor("Example", "mailto:[email protected]"); queryObject.Since = new DateTime(2013, 6, 1); queryObject.Limit = 50; int limit = 0; StatementResult actual; actual = target.GetStatements(queryObject); limit = actual.Statements.Length; Console.Write(converter.SerializeToJSON(actual)); while (limit <= 50 && !string.IsNullOrEmpty(actual.More)) { actual = target.GetStatements(actual.More); Console.Write(converter.SerializeToJSON(actual)); limit += actual.Statements.Length; //break; } Assert.Inconclusive(INCONCLUSIVE_CONSOLE); }
private WebHeaderCollection GetWebHeaders() { WebHeaderCollection whc; StatementQueryObject qo = new StatementQueryObject(); qo.Limit = 1; NameValueCollection nvc = qo.ToNameValueCollection(version); HttpMethods.GetRequest(nvc, endpoint + STATEMENTS, authentification, out whc, "0.95"); return whc; }
private static WebHeaderCollection GetWebHeaders(Uri endPoint, IAuthenticationConfiguration authentication, TCAPIVersion version) { WebHeaderCollection whc; var qo = new StatementQueryObject { Limit = 1 }; NameValueCollection nvc = qo.ToNameValueCollection(version); HttpMethods.GetRequest(nvc, endPoint + STATEMENTS, authentication, out whc, "0.95"); return whc; }