27.07.2013 Views

2 Why We Need Model-Based Testing

2 Why We Need Model-Based Testing

2 Why We Need Model-Based Testing

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

78 <strong>Model</strong> Programs<br />

// ... continued<br />

public static bool ServerSendEnabled()<br />

{<br />

return (serverSocket == Socket.Connected<br />

&& phase == Phase.Send);<br />

}<br />

// Parameter here, server can send different temperatures<br />

[Action]<br />

public static void ServerSend([Domain("Temperatures")] double datum)<br />

{<br />

clientBuffer = datum;<br />

phase = Phase.ClientReceive;<br />

}<br />

// Domain for ServerSend parameter t<br />

static Set Temperatures()<br />

{<br />

return new Set(Temp2, Temp3);<br />

}<br />

public static bool ServerCloseConnectionEnabled()<br />

{<br />

return (serverSocket == Socket.Connected);<br />

}<br />

[Action]<br />

public static void ServerCloseConnection()<br />

{<br />

serverSocket = Socket.Disconnected;<br />

}<br />

public static bool ServerCloseEnabled()<br />

{<br />

return (serverSocket != Socket.None<br />

&& serverSocket != Socket.Connected<br />

&& serverSocket != Socket.Closed);<br />

}<br />

[Action]<br />

public static void ServerClose()<br />

{<br />

serverSocket = Socket.Closed;<br />

}<br />

// continued ...<br />

Figure 5.9. Remote instrument client/server: model program (part 3).<br />

more free ebooks download links at:<br />

http://www.ebook-x.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!