in WindowsDevicePortalWrapper/UnitTestProject/MockHttpResponder.cs [61:90]
public void AddMockResponse(string endpoint, DevicePortalPlatforms platform, string friendlyOperatingSystemVersion, HttpMethods httpMethod)
{
// If no OS is provided, use the default.
if (friendlyOperatingSystemVersion == null)
{
this.AddMockResponse(endpoint, httpMethod);
return;
}
if (httpMethod != HttpMethods.Get)
{
endpoint = httpMethod.ToString() + "_" + endpoint;
}
Utilities.ModifyEndpointForFilename(ref endpoint);
HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
if (platform == DevicePortalPlatforms.IoTDragonboard410c || platform == DevicePortalPlatforms.IoTMinnowboardMax || platform == DevicePortalPlatforms.IoTRaspberryPi2 || platform == DevicePortalPlatforms.IoTRaspberryPi3)
{
string filepath = Path.Combine("MockData", "IoT", friendlyOperatingSystemVersion, endpoint + "_" + platform.ToString() + "_" + friendlyOperatingSystemVersion + ".dat");
response.Content = this.LoadContentFromFile(filepath);
}
else
{
string filepath = Path.Combine("MockData", platform.ToString(), friendlyOperatingSystemVersion, endpoint + "_" + platform.ToString() + "_" + friendlyOperatingSystemVersion + ".dat");
response.Content = this.LoadContentFromFile(filepath);
}
this.mockResponses.Add(endpoint.ToLowerInvariant(), response);
}