Example #1
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);
        }
Example #2
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));
        }
Example #3
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);
        }
        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);
        }
Example #5
0
        public async Task GetDeviceListTest()
        {
            var result = await SenseApi.GetDeviceList(int.Parse(Config["monitor-ids"]));

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