private MethodPacket BuildDeleteGroupPacket(MixPlayGroupModel groupToDelete, MixPlayGroupModel groupToReplace) { Validator.ValidateVariable(groupToDelete, "groupToDelete"); Validator.ValidateVariable(groupToReplace, "groupToReplace"); JObject parameters = new JObject(); parameters.Add("groupID", groupToDelete.groupID); parameters.Add("reassignGroupID", groupToReplace.groupID); return(new MethodParamsPacket("deleteGroup", parameters)); }
public void CreateGetUpdateDeleteGroup() { this.MixPlayWrapper(async(MixerConnection connection, MixPlayClient client) => { MixPlayConnectedSceneModel testScene = await this.CreateScene(client); this.ClearPackets(); MixPlayGroupModel testGroup = new MixPlayGroupModel() { groupID = GroupID, sceneID = testScene.sceneID }; bool result = await client.CreateGroupsWithResponse(new List <MixPlayGroupModel>() { testGroup }); Assert.IsTrue(result); this.ClearPackets(); MixPlayGroupCollectionModel groups = await client.GetGroups(); Assert.IsNotNull(groups); Assert.IsNotNull(groups.groups); Assert.IsTrue(groups.groups.Count > 0); testGroup = groups.groups.FirstOrDefault(g => g.groupID.Equals(GroupID)); MixPlayGroupModel defaultGroup = groups.groups.FirstOrDefault(g => g.groupID.Equals("default")); this.ClearPackets(); groups = await client.UpdateGroupsWithResponse(new List <MixPlayGroupModel>() { testGroup }); Assert.IsNotNull(groups); Assert.IsNotNull(groups.groups); Assert.IsTrue(groups.groups.Count > 0); testGroup = groups.groups.FirstOrDefault(g => g.groupID.Equals(GroupID)); this.ClearPackets(); result = await client.DeleteGroupWithResponse(testGroup, defaultGroup); Assert.IsTrue(result); await this.DeleteScene(client, testScene); }); }
/// <summary> /// Deletes and replaces the specified group /// </summary> /// <param name="groupToDelete">The group to delete</param> /// <param name="groupToReplace">The group to replace with</param> /// <returns>Whether the operation succeeded</returns> public async Task <bool> DeleteGroupWithResponse(MixPlayGroupModel groupToDelete, MixPlayGroupModel groupToReplace) { return(this.VerifyNoErrors(await this.SendAndListen(this.BuildDeleteGroupPacket(groupToDelete, groupToReplace)))); }
/// <summary> /// Deletes and replaces the specified group /// </summary> /// <param name="groupToDelete">The group to delete</param> /// <param name="groupToReplace">The group to replace with</param> /// <returns>The task object representing the asynchronous operation</returns> public async Task DeleteGroup(MixPlayGroupModel groupToDelete, MixPlayGroupModel groupToReplace) { await this.Send(this.BuildDeleteGroupPacket(groupToDelete, groupToReplace)); }