public static CreateSubStatementCommand Create(SubStatement subStatement) { return(new CreateSubStatementCommand() { SubStatement = subStatement }); }
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; }
public void TestJObjectCtrNestedSubStatement() { JObject cfg = new JObject(); cfg.Add("actor", Support.agent.ToJObject()); cfg.Add("verb", Support.verb.ToJObject()); cfg.Add("object", Support.subStatement.ToJObject()); var obj = new SubStatement(cfg); Assert.IsInstanceOf <SubStatement>(obj); Assert.IsNull(obj.target); }
public void TestEmptyCtr() { var obj = new SubStatement(); Assert.IsInstanceOf <SubStatement>(obj); Assert.IsNull(obj.actor); Assert.IsNull(obj.verb); Assert.IsNull(obj.target); Assert.IsNull(obj.result); Assert.IsNull(obj.context); StringAssert.AreEqualIgnoringCase("{\"objectType\":\"SubStatement\"}", obj.ToJSON()); }
public void TestJObjectCtrNestedSubStatement() { var cfg = new JObject { { "actor", Support.Agent.ToJObject() }, { "verb", Support.Verb.ToJObject() }, { "object", Support.SubStatement.ToJObject() } }; var obj = new SubStatement(cfg); Assert.IsInstanceOf <SubStatement>(obj); Assert.IsNull(obj.Target); }
/// <summary> /// Initializes static members of the <see cref="Support"/> class. /// </summary> static Support() { Agent = new Agent { Mbox = "mailto:[email protected]" }; Verb = new Verb("http://adlnet.gov/expapi/verbs/experienced") { Display = new LanguageMap() }; Verb.Display.Add("en-US", "experienced"); Activity = new Activity { ID = "http://tincanapi.com/TinCanCSharp/Test/Unit/0", Definition = new ActivityDefinition { Type = new Uri("http://id.tincanapi.com/activitytype/unit-test"), 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 { ID = "http://tincanapi.com/TinCanCSharp/Test", Definition = new ActivityDefinition { Type = new Uri("http://id.tincanapi.com/activitytype/unit-test-suite"), 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 { Registration = Guid.NewGuid(), Statement = StatementRef, ContextActivities = new ContextActivities { Parent = new List <Activity> { Parent } } }; Score = new Score { Raw = 97, Scaled = 0.97, Max = 100, Min = 0 }; Result = new Result { Score = Score, Success = true, Completion = true, Duration = new TimeSpan(1, 2, 16, 43) }; SubStatement = new SubStatement { Actor = Agent, Verb = Verb, Target = Parent }; }
static Support() { Agent = new Agent { Mbox = "mailto:[email protected]" }; Verb = new Verb("http://adlnet.gov/expapi/verbs/experienced") { Display = new LanguageMap() }; Verb.Display.Add("en-US", "experienced"); Activity = new Activity { Id = "http://tincanapi.com/TinCanCSharp/Test/Unit/0", Definition = new ActivityDefinition { Type = new Uri("http://id.tincanapi.com/activitytype/unit-test"), Name = new LanguageMap() } }; Activity.Definition.Name.Add("en-US", "Tin Can C# Tests: Unit 0"); Activity.Definition.Description = new LanguageMap { { "en-US", "Unit test 0 in the test suite for the Tin Can C# library." } }; Activity.Definition.InteractionType = InteractionType.ChoiceType; Activity.Definition.Choices = new List <InteractionComponent>(); for (int i = 1; i <= 3; i++) { var interactionComponent = new InteractionComponent { Id = "choice-" + i.ToString(), Description = new LanguageMap() }; interactionComponent.Description.Add("en-US", "Choice " + i.ToString()); Activity.Definition.Choices.Add(interactionComponent); } Activity.Definition.CorrectResponsesPattern = new List <string>(); for (int i = 1; i <= 2; i++) { Activity.Definition.CorrectResponsesPattern.Add("choice-" + i.ToString()); } Parent = new Activity { Id = "http://tincanapi.com/TinCanCSharp/Test", Definition = new ActivityDefinition { Type = new Uri("http://id.tincanapi.com/activitytype/unit-test-suite"), Name = new LanguageMap() } }; Parent.Definition.Name.Add("en-US", "Tin Can C# Tests"); Parent.Definition.Description = new LanguageMap { { "en-US", "Unit test suite for the Tin Can C# library." } }; StatementRef = new StatementRef(Guid.NewGuid()); Context = new Context { Registration = Guid.NewGuid(), Statement = StatementRef, ContextActivities = new ContextActivities { Parent = new List <Activity>() } }; Context.ContextActivities.Parent.Add(Parent); Score = new Score { Raw = 97, Scaled = 0.97, Max = 100, Min = 0 }; Result = new Result { Score = Score, Success = true, Completion = true, Duration = new TimeSpan(1, 2, 16, 43), Response = "choice-2" }; SubStatement = new SubStatement { Actor = Agent, Verb = Verb, Target = Parent }; }