SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 66 | Next

Jonathan Jacky, Margus Veanes, Colin Campbell, Wolfram Schulte

"Model-Based Software Testing and Analysis with C#"

OK);
}
This guard is similar to the previous guard, but it invokes Poll (instead of Reset)
after the time-out event when the sensor is considered to be working correctly.
Notice that different handlers might be invoked after the same event, depending on
the values of other variables. That is why we must provide a dispatcher, instead of
simply associating each handler with an event.
Each handler assigns some of the variables that are tested by the guards. Here
Reset assigns waitfor to indicate that the program is now waiting for a message
(instead of a time-out).
void Reset()
{
Console.WriteLine(" Reset");
ResetSensor(); // send reset command to sensor
StartTimer(MessageTimeout); // wait for response from sensor
waitfor = WaitFor.Message;
}
Also, the call to ResetSensor commands the sensor to reset, which should cause
another message event soon. But if no message arrives ??“ if the sensor does not
Overview 41
// Typical trouble-free scenario
[Test]
[Category("Typical")]
public void Typical()
{
Controller c = new Controller();
c.ReceiveEvent(ControlEvent.Timeout, null);
c.DispatchHandler(); // Reset expected
c.ReceiveEvent(ControlEvent.Message, "99.9");
c.DispatchHandler(); // CheckMessage
c.ReceiveEvent(ControlEvent.Timeout, null);
c.DispatchHandler(); // Poll
c.ReceiveEvent(ControlEvent.Message, "100.0");
c.DispatchHandler(); // CheckMessage
// Command before Timeout scheduled by second CheckMessage
c.


Pages:
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6