Web API integration test that depends on data inserted by a different method

  Uncategorised

Suppose I have a restaurant/reservation system, how would one go about writing integration tests for components that depends on a parent record.

For instance suppose I have a set of integration tests for the Restaurant controller where I add a restaurant. There are other attributes that can be added to a restaurant that require a restaurant ID such as phone number, email, location etc. The reservation controller also depends on a restaurant ID, so how would one go about:

  1. Ensuring the create restaurant test runs before the add restaurant phone number test.
  2. Ensuring the restaurant tests run before the reservation ones.

Thanks.

Source: Visual Studio Questions

LEAVE A COMMENT