public async Task <EvaluationResult> DeviceTwin(DeviceWebAPIParameters parms)
        {
            parms.Fix(Config);
            var context = new DeviceContext();

            return(await context.DeviceTwin(parms));
        }
        public async Task <EvaluationResult> MessageToDevice(DeviceWebAPIParameters parms)
        {
            parms.Fix(Config);
            var context = new DeviceContext();

            return(await context.ReceiveCommand(parms));
        }
        public async Task <EvaluationResult> VerifyEvents(DeviceWebAPIParameters parms)
        {
            parms.Fix(Config);
            var context = new EventHubContext(parms);
            var result  = await context.ReceiveEvents();

            return(result);
        }
        public async Task <EvaluationResult> DeviceCount(DeviceWebAPIParameters parms)
        {
            parms.Fix(Config);
            var context = new DeviceContext();
            var result  = await context.GetDeviceCount(parms);

            return(result);
        }
        public EvaluationResult CosmosDB(DeviceWebAPIParameters parms)
        {
            parms.Fix(Config);
            var context = new CosmosDBContext(parms);
            var result  = context.TestDocuments("iot", "events");

            return(result);
        }
        public async Task <EvaluationResult> Endpoint(DeviceWebAPIParameters parms)
        {
            parms.Fix(Config);
            var context = new EventHubContext(parms);
            var result  = await context.TestEndpoint();

            return(result);
        }
        public async Task <EvaluationResult> StreamAnalytics(DeviceWebAPIParameters parms)
        {
            parms.Fix(Config);
            var context = new StreamAnalyticsContext(parms);
            var result  = await context.VerifyData();

            return(result);
        }
        public async Task <EvaluationResult> GenerateData(DeviceWebAPIParameters parms)
        {
            parms.Fix(Config);
            var result = new EvaluationResult
            {
                Passed  = true,
                Code    = 0,
                Message = "Successfully processed readings"
            };

            try
            {
                result = await deviceContext.GetReadings(parms);
            }
            catch (Exception ex)
            {
                result.Passed  = false;
                result.Code    = ex.HResult;
                result.Message = $"There was an error processing readings:\t{ex.Message}";
            }
            return(result);
        }