public void TestEmptyCtr() { Verb obj = new Verb(); Assert.IsInstanceOf<Verb>(obj); Assert.IsNull(obj.id); Assert.IsNull(obj.display); StringAssert.AreEqualIgnoringCase("{}", obj.ToJSON()); }
public void TestStringOfJSONCtr() { String id = "http://adlnet.gov/expapi/verbs/experienced"; String json = "{\"id\":\"" + id + "\"}"; StringOfJSON strOfJson = new StringOfJSON(json); Verb obj = new Verb(strOfJson); Assert.IsInstanceOf<Verb>(obj); Assert.That(obj.ToJSON(), Is.EqualTo(json)); }
public void TestJObjectCtr() { String id = "http://adlnet.gov/expapi/verbs/experienced"; JObject cfg = new JObject(); cfg.Add("id", id); Verb obj = new Verb(cfg); Assert.IsInstanceOf<Verb>(obj); Assert.That(obj.ToJSON(), Is.EqualTo("{\"id\":\"" + id + "\"}")); }
static Support () { agent = new Agent(); agent.mbox = "mailto:[email protected]"; verb = new Verb("http://adlnet.gov/expapi/verbs/experienced"); verb.display = new LanguageMap(); verb.display.Add("en-US", "experienced"); activity = new Activity(); activity.id = "http://tincanapi.com/TinCanCSharp/Test/Unit/0"; activity.definition = new ActivityDefinition(); activity.definition.type = new Uri("http://id.tincanapi.com/activitytype/unit-test"); activity.definition.name = new LanguageMap(); activity.definition.name.Add("en-US", "Tin Can C# Tests: Unit 0"); activity.definition.description = new LanguageMap(); activity.definition.description.Add("en-US", "Unit test 0 in the test suite for the Tin Can C# library."); parent = new Activity(); parent.id = "http://tincanapi.com/TinCanCSharp/Test"; parent.definition = new ActivityDefinition(); parent.definition.type = new Uri("http://id.tincanapi.com/activitytype/unit-test-suite"); //parent.definition.moreInfo = new Uri("http://rusticisoftware.github.io/TinCanCSharp/"); parent.definition.name = new LanguageMap(); parent.definition.name.Add("en-US", "Tin Can C# Tests"); parent.definition.description = new LanguageMap(); parent.definition.description.Add("en-US", "Unit test suite for the Tin Can C# library."); statementRef = new StatementRef(Guid.NewGuid()); context = new Context(); context.registration = Guid.NewGuid(); context.statement = statementRef; context.contextActivities = new ContextActivities(); context.contextActivities.parent = new List<Activity>(); context.contextActivities.parent.Add(parent); score = new Score(); score.raw = 97; score.scaled = 0.97; score.max = 100; score.min = 0; result = new Result(); result.score = score; result.success = true; result.completion = true; result.duration = new TimeSpan(1, 2, 16, 43); subStatement = new SubStatement(); subStatement.actor = agent; subStatement.verb = verb; subStatement.target = parent; }