Esempio n. 1
0
        public void IsFull(MyStopWatch timer, Context context, IRaspberryPiStates emptyState,
                           IRaspberryPiStates fullState, IRaspberryPiStates notDoneState)
        {
            //Console.WriteLine("NotDoneState");
            if (LaserBot.Detected() == false)
            {
                //bt.SendData("NotDoneState");
                context.setState(notDoneState);
            }

            if (Magnet.Detected() == false && LaserBot.Detected() == true)
            {
                //bt.Init();
                string result = null;
                result = timer.StopTimer();
                Console.WriteLine(result);
                //bt.SendData(result);
                //bt.SendData("EmptyState");
                writer.JsonWriterFunc("Emptystate", result, "");
                context.setState(emptyState);
            }

            if (timer.GetTime() > MAX_TIME)
            {
                throw new InvalidOperationException("TimeOut");
            }
        }
        public void Test_get_time(string time)
        {
            _stopWatch.StartTimer();
            Thread.Sleep(1000);
            double result = _stopWatch.GetTime();

            _stopWatch.StopTimer();

            Assert.That(result, Is.EqualTo(01.00));
        }