示例#1
0
        public async Task CreateGroup()
        {
            //make sure you have lights 1 and 2 in your HUE environment
            List <string> lights = new List <string>()
            {
                "1", "2"
            };

            string groupId = await _client.CreateGroupAsync(lights);

            Assert.IsFalse(string.IsNullOrEmpty(groupId));

            //Get group and check lights
            var group = await _client.GetGroupAsync(groupId);

            await _client.DeleteGroupAsync(groupId);

            Assert.IsTrue(group.Lights.Any());
            Assert.AreEqual <int>(lights.Count, group.Lights.Count, "Should have the same number of lights");
        }
示例#2
0
        public async Task CreateGroup()
        {
            var lights = await _client.GetLightsAsync();

            List <string> newLights = new List <string>();

            newLights.Add(lights.First().Id);
            newLights.Add(lights.Last().Id);

            string groupId = await _client.CreateGroupAsync(newLights, groupType : GroupType.LightGroup);

            Assert.IsFalse(string.IsNullOrEmpty(groupId));

            //Get group and check lights
            var group = await _client.GetGroupAsync(groupId);

            await _client.DeleteGroupAsync(groupId);

            Assert.IsTrue(group.Lights.Any());
            Assert.AreEqual <int>(newLights.Count, group.Lights.Count, "Should have the same number of lights");
        }
示例#3
0
        public async Task CreateEntertainmentGroup()
        {
            var groups = await _client.GetGroupsAsync();

            if (!groups.Where(x => x.Type == Models.Groups.GroupType.Entertainment).Any())
            {
                var allLights = await _client.GetLightsAsync();

                var createResult = await _client.CreateGroupAsync(allLights.Select(x => x.Id), "Entertainment", Models.Groups.RoomClass.TV, Models.Groups.GroupType.Entertainment);

                Assert.IsNotNull(createResult);
            }
        }