public void TestExecute_ReactiveChoicePresenter(IBlackboard blackboard, ContentUnit selectedCU, ContentUnit originalCU, ContentUnit[] choices) { blackboard.Clear(); blackboard.AddUnit(selectedCU); blackboard.AddUnit(originalCU); blackboard.AddLink(originalCU, selectedCU, LinkTypes.L_SelectedContentUnit); foreach (ContentUnit choice in choices) { blackboard.AddUnit(choice); blackboard.AddLink(originalCU, choice, LinkTypes.L_Choice); } KS_Old_ReactiveChoicePresenter ks = new KS_Old_ReactiveChoicePresenter(blackboard); ks.PresenterExecute += GenerateEventHandler(selectedCU, choices, blackboard); var KSAs = ks.Precondition(); int count = KSAs.Count(); Assert.Equal(1, count); // Execute the activated choice presenter KSAs.ElementAt(0).Execute(); }
public Demo1_Reactive() { Blackboard = new Blackboard(); // Set up the ContentUnits on the blackboard Demo1_Slots_DefineCUs(Blackboard); // Set up the knowledge sources m_IDSelector = new KS_Old_ReactiveIDSelector(Blackboard); // fixme: Need to come up with interfaces for presenters, but won't know what the general presenter framework looks like until I've written more of them. m_KSChoicePresenter = new KS_Old_ReactiveChoicePresenter(Blackboard); m_IDSelector.Properties[Priority] = 20; m_KSChoicePresenter.Properties[Priority] = 10; // Set up the controller Controller = new ReactivePriorityController(); Controller.AddKnowledgeSource(m_IDSelector); Controller.AddKnowledgeSource(m_KSChoicePresenter); // Put request for starting content unit in blackboard Blackboard.AddUnit(new U_IDSelectRequest("start")); }