I am implementing a small API which send different requests to a server and works with the responses. I am using Moq and NUnit and try to implement everything in the Test First Manner. I am trying to encapsulate everything into Interfaces so I can mock them which works quite well. At some point my API is also tested by QA with real data (from the server) since the server is also being developed parallel it is sometimes not possible to tell where a bug occurs. Therefor I just wrote a test class with some unit tests which basically are just sending out the request to the server and checking is there is a response coming back. Something like that:
[Test]
public void LoginShouldBeSuccesful()
{
result = webclient.UploadString(https://someURL.com, "POST", query);
Assert.That(result,Is.Not.Null);
}
This makes is easy for me to test in VS if the server is up and running, if some requests are already implemented and working and so on. (and it is fast than using some browser REST API plugin). However I added more and more tests which rely on different webrequests (which I already put into unit tests). So when I for example wanted to test a webrequest which deletes a user generated db entry I first had to run the Login unit test -> added the response (token) to the GenerateDBEntry unit test-> added the EntryID to the DeleteEntry request.
I know that this is against the principal of unit tests since they should run an be tested totally independent of each other, but I was wondering if there is a way to have them ordered and rely on each other (via return values) so that I can create test classes which are actual use cases. If possible I want to have one use case for each test class.