public void RemoveReceptorInstance() { callSuccess = false; IReceptor receptor = new TestReceptor(); SemanticProcessor sp = new SemanticProcessor(); sp.Register <TestMembrane>(receptor); sp.RemoveTypeNotify <TestMembrane, TestSemanticType>(receptor); sp.ProcessInstance <TestMembrane, TestSemanticType>(true); Assert.That(!callSuccess, "Expected TestReceptor.Process to NOT be called."); }
public void UnitTests() { var signal = new TestSignalMatch(); var receptor = new TestReceptor(); receptor.OnSignal(signal); Assert.AreEqual(1, receptor.matchCount); var signalNoMatch = new TestSignalNoMatch(); receptor.OnSignal(signalNoMatch); Assert.AreEqual(1, receptor.matchCount); }
public void ReceptorInitialization() { receptorInitializerCalled = false; SemanticProcessor sp = new SemanticProcessor(); sp.Register <TestMembrane, TestReceptor>((ir) => { // Unfortunately, a cast is required, because ir is type declared as IReceptor // and I don't think it's possible to fix that because of the late callback. TestReceptor r = (TestReceptor)ir; r.AFlag = true; receptorInitializerCalled = true; }); sp.ProcessInstance <TestMembrane, TestSemanticType>(true); Assert.That(receptorInitializerCalled, "Expected TestReceptor initializer to be called to be called."); }