示例#1
0
        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);
        }
示例#2
0
        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')
        }
示例#3
0
 public ActiveHandler(AnonymousFunctions context) : base(context)
 {
 }
示例#4
0
 public StateHandlerBase(AnonymousFunctions context)
 {
     m_Context = context;
     m_Context.CurrentStateHandler = this;
     m_Context.OnStateChanged?.Invoke(context, CurrentState);
 }
示例#5
0
 public ErrorHandler(AnonymousFunctions context) : base(context)
 {
 }
示例#6
0
 public void StringIsLongPredicateTest()
 {
     Assert.IsTrue(AnonymousFunctions.StringIsLongPredicate("g5F|z*tC&yKJU$"));
 }