Example #1
0
        public void MyTestCleanup()
        {
            DevicesOpenedDuringTest.ForEach(x =>
            {
                //x.Sync();
                // would like to reset so board is in original state every time we connect
                x.SoftReset();   // resets state without dropping connection
                // would we do this and wait instead
                //x.HardReset(); // like disconnecting the power
                x.Disconnect();
                LOG.Info("Disconnected " + x.ToString());
            });
            ConnectionsOpenedDuringTest.ForEach(x =>
            {
                if (x.CanClose())
                {
                    x.Disconnect();
                    LOG.Info("Disconnected " + x.ToString());
                }
            });
            GoodConnection_ = null;

            CapturedLogs_               = null;
            CapturedConnectionState_    = null;
            CapturedSingleQueueAllType_ = null;
            HandlerObservable_          = null;

            System.Threading.Thread.Sleep(100);
            LOG.Debug("Done MyTestCleanup");
        }
Example #2
0
        /// <summary>
        /// Wrap the custom handler with our instrumentation handlers.
        /// Additional observers may be added once the board is initialized
        /// </summary>
        /// <param name="customHandler">additional handler provided by object creator. </param>
        /// <param name="customHandler">observers added to the default handler. </param>
        private void ConfigureHandlers(IIncomingHandlerIOIO customHandler, List <IObserverIOIO> observers)
        {
            // we want this one to be blocking so that outbound wait for resources
            CaptureOutboundObservable_ = new IOIOHandlerObservable();
            // we want this one to be non blocking
            CaptureInboundObservable_ = new IOIOHandlerObservableNoWait();

            CapturedConnectionInformation_ = new ObserverConnectionState();
            CaptureInboundObservable_.Subscribe(CapturedConnectionInformation_);
            // add the passed in observers
            // observers using the default handler threading model
            if (observers != null)
            {
                foreach (IObserverIOIO oneObserver in observers)
                {
                    CaptureInboundObservable_.Subscribe(oneObserver);
                }
            }
            // probably observers attached to something other than the default threading model
            if (customHandler != null)
            {
                InboundHandler_ = new IOIOHandlerDistributor(
                    new List <IIncomingHandlerIOIO> {
                    CaptureInboundObservable_, customHandler
                });
            }
            else
            {
                InboundHandler_ = CaptureInboundObservable_;
            }
        }
Example #3
0
        /// <summary>
        /// Creates a standard HandlerContainer_ set and put it in instance variables so all tests can use.
        /// Create one of each of the standard types
        /// </summary>
        internal void CreateCaptureLogHandlerSet()
        {
            // create handlers of our own so we don't have to peek in and understand how IOIOImpl is configured

            CapturedSingleQueueAllType_ = new ObserverCaptureSingleQueue();
            CapturedLogs_            = new ObserverLogAndCaptureLog(10);
            CapturedConnectionState_ = new ObserverConnectionState();
            HandlerObservable_       = new IOIOHandlerObservableNoWait();
            HandlerObservable_.Subscribe(CapturedLogs_);
            HandlerObservable_.Subscribe(CapturedConnectionState_);
            HandlerObservable_.Subscribe(CapturedSingleQueueAllType_);
        }