title: How to test an application when each call changes state of the system?
body: <p>Testing is simple when you have methods that you can call 100 times and they yield the same results. But how do you test something like an Api, where you have something like this:</p>
  
  <pre><code>int CreateUser(username,password); //returns the id of the user, -1 if error
  int SubmitOrder(username,password,productName,quantity);//returns the id of the order -1 if error
  int CancelOrder(username,password,orderId); //returns -1 if error
  </code></pre>
  
  <p>How would you test that this Api works? How do you create test data? I can not write unit tests fot it, I can not use the same test data, since I can not create a user two times(UserName is unique). When I submit an order I always get different orderIds as responses. </p>