コード例 #1
0
        public async Task GetUsageTrendDataForA1HourInterval()
        {
            var result = await SenseApi.GetUsageTrendData(int.Parse(Config["monitor-ids"]), Granularity.Hour, DateTime.Now.AddDays(-1));

            Assert.IsTrue(result.Steps == 60);
            Assert.IsTrue(result.Scale == "hour");
        }
コード例 #2
0
        public async Task GetMonitorHistoryInDays()
        {
            const int sampleCount = 365;
            var       result      = await SenseApi.GetMonitorHistory(int.Parse(Config["monitor-ids"]), Granularity.Day, DateTime.Now.AddDays(-365), sampleCount);

            Assert.IsTrue(result.Totals.Count == sampleCount);
        }
コード例 #3
0
        public async Task GetTimelineData()
        {
            var result = await SenseApi.GetTimelineData(int.Parse(Config["user-id"]));

            Assert.IsTrue(result.UserId == int.Parse(Config["user-id"]));
            Assert.IsTrue(result.Items.Count > 0);
        }
コード例 #4
0
        public async Task MakeSureDeviceListGetsUpdatedWithDeviceDetailsTest()
        {
            await SenseApi.GetDeviceList(int.Parse(Config["monitor-ids"]));

            var deviceDetails = await SenseApi.GetDeviceDetails(int.Parse(Config["monitor-ids"]), SenseApi.DeviceList.First().Id);

            Assert.IsTrue(SenseApi.DeviceList.Find(x => x.Id == deviceDetails.Device.Id).LastState != null);
        }
コード例 #5
0
        public async Task GetOtherDetails()
        {
            if (SenseApi.DeviceList == null || SenseApi.DeviceList.Count == 0)
            {
                await SenseApi.GetDeviceList(int.Parse(Config["monitor-ids"]));
            }

            var result = await SenseApi.GetOtherDetails(int.Parse(Config["monitor-ids"]));

            Assert.IsTrue(result.Device.Id.Contains("unknown", StringComparison.InvariantCultureIgnoreCase));
        }
コード例 #6
0
        public async Task GetDeviceDetails()
        {
            if (SenseApi.DeviceList == null || SenseApi.DeviceList.Count == 0)
            {
                await SenseApi.GetDeviceList(int.Parse(Config["monitor-ids"]));
            }

            var rnd = new Random();
            var r   = rnd.Next(SenseApi.DeviceList.Count);

            var result = await SenseApi.GetDeviceDetails(int.Parse(Config["monitor-ids"]), SenseApi.DeviceList[r].Id);

            Assert.IsTrue(result.Device.Id == SenseApi.DeviceList[r].Id);
        }
コード例 #7
0
        public async Task GetDeviceHistoryInHours()
        {
            const int sampleCount = 720;

            if (SenseApi.DeviceList == null || SenseApi.DeviceList.Count == 0)
            {
                await SenseApi.GetDeviceList(int.Parse(Config["monitor-ids"]));
            }

            var rnd = new Random();
            var r   = rnd.Next(SenseApi.DeviceList.Count);

            var result = await SenseApi.GetDeviceHistory(int.Parse(Config["monitor-ids"]), SenseApi.DeviceList[r].Id, Granularity.Hour, DateTime.Now.AddDays(-30), sampleCount);

            Assert.IsTrue(result.Totals.Count == sampleCount);
        }
コード例 #8
0
        public async Task CheckMonitorStatus()
        {
            var result = await SenseApi.GetMonitorStatus(int.Parse(Config["monitor-ids"]));

            Assert.IsTrue(result.MonitorInfo.Serial != null);
        }
コード例 #9
0
 public async Task UnsuccessfulAuthenticationTest()
 {
     await SenseApi.Authenticate("*****@*****.**", "WhatIsGoingOn");
 }
コード例 #10
0
        public async Task GetDeviceListTest()
        {
            var result = await SenseApi.GetDeviceList(int.Parse(Config["monitor-ids"]));

            Assert.IsTrue(result.Count > 0);
        }