public void SetUp()
 {
     containingObject = new GameObject();
     subject          = containingObject.AddComponent <StateEmitter>();
     actionObject     = new GameObject();
     action           = actionObject.AddComponent <BooleanAction>();
 }
Exemple #2
0
        public Buffer SetState(QpcTimeStamp qpcTimeStamp, BufferState state, string reason)
        {
            BufferState entryState = State;

            State     = state;
            TimeStamp = qpcTimeStamp;

            switch (state)
            {
            case BufferState.SendPosted: CopyHeaderToByteArray(); SendPostedTimeStamp = qpcTimeStamp; break;

            case BufferState.Received: UpdateHeaderFromByteArray(); break;

            default: break;
            }

            if (StateEmitter.IsEnabled)
            {
                StateEmitter.Emit("{0} State changed to {1} [from: {2}, reason: {3}]", BufferName, state, entryState, reason ?? "NoReasonGiven");
            }

            INotifyable notifyOnStateChange = NotifyOnSetState;

            if (notifyOnStateChange != null)
            {
                notifyOnStateChange.Notify();
            }

            return(this);
        }