示例#1
0
        public async Task GetAllSensorsTest()
        {
            IHueRequest request = new GetAllSensorsRequest();

            var response = await _client.GetResponseAsync(request);

            Assert.True(response is GetAllSensorsResponse);
            OnLog(response);
        }
示例#2
0
        private Task DeleteTmpSensorAsync()
        {
            OnLog("Teardown: deleteing temporary sensors");
            IHueRequest request = new GetAllSensorsRequest();

            return(_client.GetResponseAsync(request).ContinueWith(getAllSensors =>
            {
                var tempSensors = ((GetAllSensorsResponse)getAllSensors.Result).Where(p => p.ModelId == "TMPSENSOR")
                                  .ToList();
                Task.WhenAll(tempSensors.Select(p => _client.GetResponseAsync(new DeleteSensorRequest(p.Id)).ContinueWith(deleteResponse =>
                {
                    var deleteResponseResult = deleteResponse.Result;
                    Assert.True(deleteResponseResult is SuccessResponse);
                    OnLog(deleteResponseResult);
                }))).Wait();
            }));
        }
示例#3
0
 public async Task <List <SensorRegistryRecord> > Handle(
     GetAllSensorsRequest request,
     CancellationToken token)
 {
     return(await registryCache.GetAllRecords());
 }