public async Task DataStream_Postgres_StreamQuery_Test()
        {
            var stream    = GetValidStream();
            var connector = new PostgresqlConnector(_logger);

            AssertSuccessful(await connector.InitAsync(stream));

            var deviceId = "DEV001";

            for (var idx = 0; idx < 20; ++idx)
            {
                AssertSuccessful(await AddRecord(connector, stream, deviceId, idx + 300, idx + 200));
            }

            var filteredItems = new Dictionary <string, object>()
            {
            };


            var query = "select time_bucket('1.5 minutes', timeStamp) as period, avg(int1)";

            var result = await connector.GetTimeSeriesAnalyticsAsync(query, filteredItems, new Core.Models.UIMetaData.ListRequest()
            {
                PageSize = 50
            });

            Assert.IsTrue(result.Successful);
        }
        public async Task DataStream_Postgres_Stream_Request_Test()
        {
            var stream    = GetValidStream();
            var connector = new PostgresqlConnector(_logger);

            AssertSuccessful(await connector.InitAsync(stream));

            var deviceId = "DEV001";

            var recordCount = 20;

            for (var idx = 0; idx < 20; ++idx)
            {
                var dateStamp = DateTime.Now.AddSeconds((idx - recordCount) * 20);
                AssertSuccessful(await AddRecord(connector, stream, deviceId, idx + 300, idx + 200, dateStamp.ToJSONString()));
            }

            var request = new TimeSeriesAnalyticsRequest()
            {
                Window     = Windows.Minutes,
                WindowSize = 1,
            };

            request.Fields.Add(new TimeSeriesAnalyticsRequestField()
            {
                Name = "int1", Operation = Operations.Average
            });

            var results = await connector.GetTimeSeriesAnalyticsAsync(request, new Core.Models.UIMetaData.ListRequest()
            {
                PageSize = 50
            });

            foreach (var result in results.Model)
            {
                Console.WriteLine(result);
            }
        }