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.

Systems with Complex State 177<br />

}<br />

}<br />

revisions = revisions.Override(user, userRevisions.Add(file,<br />

(op == Op.Delete ? Op.Delete : Op.Add)));<br />

Revert action<br />

Edits may be undone using the Revert action. This restores the client’s view a given<br />

file to be consistent with the last update (checkout) operation.<br />

partial static class User<br />

{<br />

static bool RevertEnabled(string user, string file)<br />

{<br />

return CanStep(user) && revisions[user].ContainsKey(file);<br />

}<br />

}<br />

[Action]<br />

static void Revert([Domain("Users")] string user, string file)<br />

{<br />

revisions = revisions.Override(user,<br />

revisions[user].RemoveKey(file));<br />

}<br />

Commit action<br />

The Commit action begins the process of recording edits made by a client in the<br />

global repository.<br />

partial static class User<br />

{<br />

static bool CommitEnabled(string user)<br />

{<br />

return CanStep(user);<br />

}<br />

[Action]<br />

static void Commit([Domain("Users")] string user)<br />

{<br />

commitPending = commitPending.Add(user);<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!