public void AnonymousMethodTest() { AnonymousFunctions _newInstance = new AnonymousFunctions(); bool _testResult = false; AnonymousFunctions.CallBackTestDelegate _CallBackTestResult = delegate(bool _result) { _testResult = _result; }; //void _CallBackTestResult(bool _result) { _testResult = _result; } _newInstance.ConsistencyCheck(_CallBackTestResult); Assert.IsTrue(_testResult); }
public void EventTestMethod() { AnonymousFunctions _newInstance = new AnonymousFunctions(); State _currentState = _newInstance.CurrentStateHandler.CurrentState; _newInstance.OnStateChanged += (x, y) => _currentState = y; Assert.AreEqual <State>(State.Idle, _currentState); _newInstance.CurrentStateHandler.GoToActive(); Assert.AreEqual <State>(State.Active, _currentState); _newInstance.CurrentStateHandler.GoToIdle(); Assert.AreEqual <State>(State.Idle, _currentState); //_newInstance.OnStateChanged(_newInstance, _newInstance.CurrentStateHandler.CurrentState); //Error CS0070 The event 'AnonymousFunctions.OnStateChanged' can only appear on the left hand side of += or -= (except when used from within the type 'AnonymousFunctions') }
public ActiveHandler(AnonymousFunctions context) : base(context) { }
public StateHandlerBase(AnonymousFunctions context) { m_Context = context; m_Context.CurrentStateHandler = this; m_Context.OnStateChanged?.Invoke(context, CurrentState); }
public ErrorHandler(AnonymousFunctions context) : base(context) { }
public void StringIsLongPredicateTest() { Assert.IsTrue(AnonymousFunctions.StringIsLongPredicate("g5F|z*tC&yKJU$")); }