In OData WebApi, there are unit test, e2e test for V3 and V4, those test cases are to ensure the feature and bug fix, also to make sure not break old functionality.
Every class in OData WebApi has it’s own unit test class, for example:
OData/src/System.Web.OData/OData/Builder/ActionLinkBuilder.cs ‘s test class is
You can find that the structural under System.Web.OData folder and System.Web.OData.Test folder are the same, also for V3 System.Web.Http.OData.Test, so if your pull request contains any class add/change, you should add/change(this change here means add test cases) unit test file.
How To Add Unit Test
Try to avoid other dependency use moq.
Make sure you add/change the right class(V4 or V3 or both).
Can add functinal test for complicate scenario, but E2E test cases are better.
E2E test are complete test for user scenarios, always begin with client request and end with server response. If your unit test in pull request can’t cover all scenario well or you have a big pull request, please add E2E test for it.
How To Add E2E Test
Add test cases in exist test class that related to your pull request.
Add new folder and test class for your own scenario.
If the test has any kind of state that is preserved between request, it should be the only test defined in the test class to avoid conflicts when executed along other tests.
Try to test with both in memory data and DB data.
Keep test folder, class style with exist test folder, class.