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.

66 <strong>Model</strong> Programs<br />

}<br />

}<br />

static bool ShowTitlesEnabled()<br />

{<br />

return (page == Page.Topics && style == Style.WithText);<br />

}<br />

[Action]<br />

static void ShowTitles()<br />

{<br />

style = Style.TitlesOnly;<br />

}<br />

static bool ShowTextEnabled()<br />

{<br />

return (page == Page.Topics && style == Style.TitlesOnly);<br />

}<br />

[Action]<br />

static void ShowText()<br />

{<br />

style = Style.WithText;<br />

}<br />

static bool SortByFirstEnabled()<br />

{<br />

return (page == Page.Topics && style == Style.TitlesOnly<br />

&& sort == Sort.ByMostRecent);<br />

}<br />

[Action]<br />

static void SortByFirst()<br />

{<br />

sort = Sort.ByFirst;<br />

}<br />

static bool SortByMostRecentEnabled()<br />

{<br />

return (page == Page.Topics && style == Style.TitlesOnly<br />

&& sort == Sort.ByFirst);<br />

}<br />

[Action]<br />

static void SortByMostRecent()<br />

{<br />

sort = Sort.ByMostRecent;<br />

}<br />

Figure 5.5. <strong>We</strong>b-based newsreader: model program (part 2).<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!