Beispiel #1
0
        private static DeviceModelResponse CreateDeviceModel(DeviceModelRequest deviceModelRequest)
        {
            HttpResponseMessage httpResponseMessage = _apiClient.PostResourceAsync <DeviceModelRequest>(deviceModelRequest).Result;

            DeviceModelResponse dmresp = _apiClient.GetResourceFromHttpResponseAsync <DeviceModelResponse>(httpResponseMessage).Result;

            return(dmresp);
        }
Beispiel #2
0
        static async Task <IList <DeviceModelResponse> > CreateDeviceModelsAsync()
        {
            int createThisMany = 25;

            IList <DeviceModelResponse> responses = new List <DeviceModelResponse>(createThisMany);
            IList <DeviceModelRequest>  requests  = _generator.GetDeviceModelRequests(createThisMany);

            foreach (DeviceModelRequest request in requests)
            {
                HttpResponseMessage httpResponseMessage = await _apiClient.PostResourceAsync(request);

                DeviceModelResponse response = await _apiClient.GetResourceFromHttpResponseAsync <DeviceModelResponse>(httpResponseMessage);

                responses.Add(response);
            }

            return(responses);
        }