예제 #1
0
        public void OnStartCancelPressed(object sender, EventArgs e)
        {
            switch (myState)
            {
            case States.SETPOWER:
                powerLevel = 50;
                time       = 1;
                myLight.TurnOff();
                myDisplay.Clear();
                myState = States.READY;
                break;

            case States.SETTIME:
                //myDisplay.Clear(); //Display should not clear
                myLight.TurnOn();
                myCooker.StartCooking(powerLevel, time * 60);
                myState = States.COOKING;
                break;

            case States.COOKING:
                powerLevel = 50;
                time       = 1;
                myCooker.Stop();
                myLight.TurnOff();
                myDisplay.Clear();
                myState = States.READY;
                break;
            }
        }
예제 #2
0
        public void OnStartCancelPressed(object sender, EventArgs e)
        {
            switch (myState)
            {
            case States.SETPOWER:
                powerLevel = 50;
                time       = 1;
                myLight.TurnOff();
                myDisplay.Clear();
                myState = States.READY;
                break;

            case States.SETTIME:
                /*myDisplay.Clear();*/      //Fejl ifølge sekvensdiagram og UC
                myLight.TurnOn();
                myCooker.StartCooking(powerLevel, time * 60);
                myState = States.COOKING;
                break;

            case States.COOKING:
                powerLevel = 50;
                time       = 1;
                myCooker.Stop();
                myLight.TurnOff();
                myDisplay.Clear();
                myState = States.READY;
                break;
            }
        }
예제 #3
0
        private void EjectPressed(object o, EventArgs e)
        {
            // Her mangler kode til at behandle denne trigger
            // Lad dig inspirere af de nedenstående implementationer for andre triggere

            switch (state)
            {
            case State.Ready:
                Tray.Open();
                Display.Clear();
                state = State.TrayOpen;
                break;

            case State.TrayOpen:
                Tray.Close();
                state = State.Ready;
                Display.Write("Ready");
                break;

            case State.Playing:
                Driver.Stop();
                Tray.Open();
                Display.Clear();
                break;

            case State.Paused:
                Tray.Open();
                Driver.Stop();
                Display.Clear();
                state = State.TrayOpen;
                break;
            }
        }
예제 #4
0
        public void DoorOpenedWhileCooking_StopCookControllerDisplayCleared()
        {
            _powerButton.Press();
            _timeButton.Press();
            _startCancelButton.Press();
            _uut.Open();

            Received.InOrder(() =>
            {
                _cookController.Stop();
                _display.Clear();
            });
        }
예제 #5
0
 public void CookingIsDone()
 {
     switch (myState)
     {
         case States.COOKING:
             powerLevel = 50;
             time = 1;
             myDisplay.Clear();
             myLight.TurnOff();
             // Beep 3 times
             myState = States.READY;
             break;
     }
 }
        public void Clear_OutputIsCalledCorrectly(int power)
        {
            // Act:
            _tlm.Clear();

            Assert.That(textWriter.ToString(), Contains.Substring("Display cleared"));
        }
예제 #7
0
        //Run every time new data is present
        private void Update(RawTransponderDataEventArgs e)
        {
            //Decode Data
            List <TrackData> trackData = _decoder.Decode(e);

            //Filter data
            trackData = _filter.Filter(trackData);

            //Update existing flight data
            _data = _flightCalculator.Calculate(_data, trackData);

            //Collision Detect
            Tuple <List <string>, List <string> > collisionResult = _collisionDetector.SeperationCheck(trackData);
            List <string> collisionTags        = collisionResult.Item1;
            List <string> displayCollisionList = collisionResult.Item2;


            //Set CollisionFlag on flights
            foreach (KeyValuePair <string, FlightData> entry in _data)
            {
                entry.Value.CollisionFlag = collisionTags.Contains(entry.Value.Tag);
            }

            //Display Data
            _display.Clear();
            _display.Render(_data, displayCollisionList);
        }
예제 #8
0
        public void TestDisplay_Clear_CorrectOutput()
        {
            Console.SetOut(_stringWriter);
            _display.Clear();

            Assert.That(_stringWriter.ToString().Contains("cleared"));
        }
예제 #9
0
        public void Clear_ShowsClearCommand_CorrectDisplay()
        {
            _display.Clear();
            string compareString = $"Display cleared";

            _output.Received().OutputLine(compareString);
        }
예제 #10
0
        public static IDisplay Set(this IDisplay display, string text)
        {
            display.Clear();
            display.Append(text);
            display.Format();

            return(display);
        }
예제 #11
0
        public void ClearDisplay_Test()
        {
            string expectedOutput = "Display cleared\r\n";

            _display.Clear();

            Assert.That(_sw.ToString(), Is.EqualTo(expectedOutput));
        }
예제 #12
0
 public void Clear()
 {
     primaryDisplay.Clear();
     foreach (IDisplay d in auxilaryDisplays)
     {
         d.Clear();
     }
 }
예제 #13
0
        public void OnStartCancelPressed(object sender, EventArgs e)
        {
            switch (myState)
            {
            case States.SETPOWER:
                powerLevel = 50;
                time       = 1;
                myLight.TurnOff();
                myDisplay.Clear();
                myState = States.READY;
                break;

            case States.SETTIME:
                myDisplay.Clear();
                myLight.TurnOn();
                myCooker.StartCooking(Convert.ToInt32(Math.Round(Convert.ToDouble(powerLevel) / 7)), time * 60000);   //rettelse
                myState = States.COOKING;
                break;

            case States.COOKING:
                powerLevel = 50;
                time       = 1;
                myCooker.Stop();
                myLight.TurnOff();
                myDisplay.Clear();
                myState = States.READY;
                break;
            }
        }
예제 #14
0
        public void OnStartCancelPressed(object sender, EventArgs e)
        {
            switch (myState)
            {
            case States.SETPOWER:
                powerLevel = 50;
                time       = 1;
                // I think this is a mistake, since on the STM
                // It doesnt say anything about a light
                // // it also fails with the integration test
                //myLight.TurnOff();
                myDisplay.Clear();
                myState = States.READY;
                break;

            case States.SETTIME:
                myDisplay.Clear();
                myLight.TurnOn();
                myCooker.StartCooking((powerLevel / 7), time * 60);
                myState = States.COOKING;
                break;

            case States.COOKING:
                powerLevel = 50;
                time       = 1;
                myCooker.Stop();
                myLight.TurnOff();
                myDisplay.Clear();
                myState = States.READY;
                break;
            }
        }
예제 #15
0
 private void RenderSeparations(object sender, EventSeparation e)
 {
     _display.Clear();
     _display.Write("***Separations***");
     foreach (var sep in e.SeparationData)
     {
         var str = "Tag1: " + sep.Tag1 + " Tag2: " + sep.Tag2 + sep.TimeStamp;
         _display.Write(str);
     }
 }
 public void DoorOpenedDuringSetUp_DisplayCleared_LightTurnsOn()
 {
     _powerButton.Press();
     _door.Open();
     Received.InOrder(() =>
     {
         _light.TurnOn();
         _display.Clear();
     });
 }
예제 #17
0
        public void Clear_ExpectedOutputInConsole_Correct()
        {
            StringWriter stringWriter = new StringWriter();

            Console.SetOut(stringWriter);

            display.Clear();

            Assert.That(stringWriter.ToString().ToLower().Contains("cleared"));
        }
예제 #18
0
 public void MoveSnake()
 {
     foreach (var element in Body)
     {
         _display.Clear(element.DistanceFromLeft, element.DistanceFromTop);
         element.Move();
         _display.SnakeElement(element.DistanceFromLeft, element.DistanceFromTop);
     }
     InheritDirectionOfMoveFromPreviousElement();
 }
        public void Test_Clear()
        {
            Console.SetOut(_writer);

            _display.Clear();

            string ConsoleOutput = _writer.ToString();

            Assert.That(ConsoleOutput, Is.EqualTo($"Display cleared\r\n"));
        }
예제 #20
0
 public void Clear()
 {
     if ((mode & Target.Cashier) == Target.Cashier)
     {
         cashierDisplay.Clear();
     }
     if ((mode & Target.Customer) == Target.Customer)
     {
         customerDisplay.Clear();
     }
 }
예제 #21
0
        public void Display_Clear()
        {
            string       Log;
            StringWriter stringWriter = new StringWriter();

            Console.SetOut(stringWriter);

            _sut.Clear();

            Log = stringWriter.ToString();
            Assert.That(Log, Is.EqualTo("Display cleared\r\n"));
        }
예제 #22
0
        public void OnStartCancelPressed(object sender, EventArgs e)
        {
            switch (myState)
            {
            case States.SETPOWER:
                powerLevel = 50;
                time       = 1;
                myLight.TurnOff();
                myDisplay.Clear();
                myState = States.READY;
                break;

            case States.SETTIME:
                //myDisplay.Clear(); Slettet linje per UC definition
                myLight.TurnOn();
                myCooker.StartCooking(powerLevel, (time * 60) * 1000); //Sender sekunder, forventer millisekunder dette er rettet
                myState = States.COOKING;
                break;

            case States.COOKING:
                powerLevel = 50;
                time       = 1;
                myCooker.Stop();
                myLight.TurnOff();
                myDisplay.Clear();
                myState = States.READY;
                break;
            }
        }
        public void OnStartCancelPressed(object sender, EventArgs e)
        {
            switch (myState)
            {
            case States.SETPOWER:
                powerLevel = 50;
                time       = TimeSpan.FromMinutes(1);
                myLight.TurnOff();
                myDisplay.Clear();
                myState = States.READY;
                break;

            case States.SETTIME:
                myDisplay.Clear();
                myLight.TurnOn();
                myCooker.StartCooking(powerLevel, time);
                myState = States.COOKING;
                break;

            case States.COOKING:
                powerLevel = 50;
                time       = TimeSpan.FromMinutes(1);
                myCooker.Stop();
                myLight.TurnOff();
                myDisplay.Clear();
                myState = States.READY;
                break;
            }
        }
        public void OnStartCancelPressed(object sender, EventArgs e)
        {
            switch (myState)
            {
            case States.SETPOWER:
                powerLevel = 50;
                time       = 1;
                myLight.TurnOff();
                myDisplay.Clear();
                myState = States.READY;
                break;

            case States.SETTIME:
                //Hvorfor clearer den her? Det står ikke i sekvensdiagrammet
                myDisplay.Clear();
                myLight.TurnOn();
                myCooker.StartCooking(powerLevel, time * 60);
                myState = States.COOKING;
                break;

            case States.COOKING:
                powerLevel = 50;
                time       = 1;
                myCooker.Stop();
                myLight.TurnOff();
                myDisplay.Clear();
                myState = States.READY;
                break;
            }
        }
예제 #25
0
        public void OnStartCancelPressed(object sender, EventArgs e)
        {
            switch (myState)
            {
            case States.SETPOWER:
                ResetValues();
                myDisplay.Clear();
                myState = States.READY;
                break;

            case States.SETTIME:
                myLight.TurnOn();
                myCooker.StartCooking(powerLevel, time * 60);
                myState = States.COOKING;
                break;

            case States.COOKING:
                ResetValues();
                myCooker.Stop();
                myLight.TurnOff();      //Vi indsætter nedenfor TurnOn da der skal være lys i microen når man starter den
                //myLight.TurnOn();
                myDisplay.Clear();
                myState = States.READY;
                break;
            }
        }
예제 #26
0
        public void OnStartCancelPressed(object sender, EventArgs e)
        {
            switch (myState)
            {
            case States.SETPOWER:
                ResetValues();
                myDisplay.Clear();
                myState = States.READY;
                break;

            case States.SETTIME:
                myLight.TurnOn();
                // Added *1000 to turn the time variable into miliseconds, as the timer component works with that precision.
                myCooker.StartCooking(powerLevel, time * 60 * 1000);
                myState = States.COOKING;
                break;

            case States.COOKING:
                ResetValues();
                myCooker.Stop();
                myLight.TurnOff();
                myDisplay.Clear();
                myState = States.READY;
                break;
            }
        }
예제 #27
0
        public void OnStartCancelPressed(object sender, EventArgs e)
        {
            switch (myState)
            {
            case States.SETPOWER:
                powerLevel = 50;
                time       = 1;
                myLight.TurnOff();
                myDisplay.Clear();
                myState = States.READY;
                break;

            case States.SETTIME:
                myDisplay.Clear();
                myLight.TurnOn();
                myCooker.StartCooking(powerLevel, time * 60);   //Tid skal være seconds konsekvent over det hele.
                myState = States.COOKING;
                break;

            case States.COOKING:
                powerLevel = 50;
                time       = 1;
                myCooker.Stop();
                myLight.TurnOff();
                myDisplay.Clear();
                myState = States.READY;
                break;
            }
        }
예제 #28
0
        public void OnStartCancelPressed(object sender, EventArgs e)
        {
            switch (myState)
            {
            case States.SETPOWER:
                powerLevel = 50;
                time       = 1;
                myLight.TurnOff();
                myDisplay.Clear();
                myState = States.READY;
                break;

            case States.SETTIME:
                //Removed Display.Clear(), not in diagrams
                //myDisplay.Clear();
                myLight.TurnOn();
                //Divide powerlevel with 7 to get procentage
                myCooker.StartCooking(powerLevel / 7, time * 60);
                myState = States.COOKING;
                break;

            case States.COOKING:
                powerLevel = 50;
                time       = 1;
                myCooker.Stop();
                myLight.TurnOff();
                myDisplay.Clear();
                myState = States.READY;
                break;
            }
        }
예제 #29
0
        public void OnStartCancelPressed(object sender, EventArgs e)
        {
            switch (myState)
            {
            case States.SETPOWER:
                ResetValues();
                myDisplay.Clear();
                myState = States.READY;
                break;

            case States.SETTIME:
                myLight.TurnOn();
                myCooker.StartCooking(powerLevel, time * 60);
                myState = States.COOKING;
                break;

            case States.COOKING:
                ResetValues();
                myCooker.Stop();
                myLight.TurnOff();
                myDisplay.Clear();
                myState = States.READY;
                break;
            }
        }
예제 #30
0
        public void OnStartCancelPressed(object sender, EventArgs e)
        {
            switch (myState)
            {
            case States.SETPOWER:
                powerLevel = 50;
                time       = 1;
                myLight.TurnOff();
                myDisplay.Clear();
                myState = States.READY;
                break;

            case States.SETTIME:
                myDisplay.Clear();
                myLight.TurnOn();

                // Calculate powerLevel to percent
                int powerPercentLevel = (700 - powerLevel) * 100 / 700;
                powerPercentLevel = 100 - powerPercentLevel;

                myCooker.StartCooking(powerPercentLevel, time * 60);
                myState = States.COOKING;
                break;

            case States.COOKING:
                powerLevel = 50;
                time       = 1;
                myCooker.Stop();
                myLight.TurnOff();
                myDisplay.Clear();
                myState = States.READY;
                break;
            }
        }