4. Each test should start with a call to TestHelpers.MockHttpResponder.AddMockResponse to prepare a mock response for a specified enpoint in one of three ways:
4. Each test should start with a call to TestHelpers.MockHttpResponder.AddMockResponse to prepare a mock response for a specified endpoint in one of three ways:
| /Address | URL for device (eg. https://10.0.0.1:11443) |
| /User | WDP username |
| /Pwd | WDP password |
| /Endpoint | API to call (default is all endoints in program.cs) |
| /Method | HTTP method to use (default is GET) |
| /Directory | Directory to save mock data file(s) (default is .\MockData) |
### MockDataGenerator File Name Format
All mock data is saved as files in the \<endpoint\>\_\<platform\>\_\<friendly OS version\>.dat format, such as api_os_devicefamily_XboxOne_rs1_xbox_rel_1608.dat.
All file names are pre-pended with the HTTP method except for GET (as it is the default). Hence the file name for calling the System Performance API with GET is api_resourcemanager_systemperf_XboxOne_rs1_xbox_rel_1608.dat but calling the WebSocket is WebSocket_api_resourcemanager_systemperf_XboxOne_rs1_xbox_rel_1608.dat.
### MockDataGenerator Examples
All examples connect to 10.0.0.1:11443 with username TestUser and password SuperSecret.
* Generate all mocks specified in the Program.cs Endpoints array and store them in .\MockData
* Device-version mock data should be added to the MockData<Device\>\ \<Friendly OS Version\> directory with the Friendly OS Version parsed from the mock data’s file name.
2. In the properties view the mock data files should have their “Copy to Output Directory” property marked as “Copy if newer.” If this is not done then the tests will be unable to find the files.