public Task AddOutputToComponent(string virtualStudioName, int componentId, StudioComponentEndpointDto endpoint) { if (!TryFindComponent(componentId, out ComponentViewModel component)) { throw new Exception($"Cannot find component with ID {componentId}."); } component.Outputs.Add(new StudioComponentEndpointViewModel(component, endpoint)); return(Task.CompletedTask); }
public async Task Adds_an_Output_to_a_PlaceholderComponent_in_ComponentRepository() { var placeholder = virtualStudio.ComponentRepository.Placeholders.First(); var newOutput = new StudioComponentEndpointDto { Id = 0, Name = "New Output", DataKind = DataKind.Audio, ConnectionType = "UDP" }; var addOutputToPlaceholderCommand = new AddOutputToPlaceholderCommand(placeholder.Id, newOutput); await addOutputToPlaceholderCommand.Process(virtualStudio); Assert.IsTrue(placeholder.Outputs.Count == 1); Assert.AreEqual(newOutput.Name, placeholder.Outputs[0].Name); Assert.AreEqual(EndpointIOType.Output, placeholder.Outputs[0].IOType); Assert.AreEqual(newOutput.DataKind, placeholder.Outputs[0].DataKind); Assert.AreEqual(newOutput.ConnectionType, placeholder.Outputs[0].ConnectionType); }
public void Creates_the_ViewModel_from_DTO() { StudioComponentEndpointDto dto = new StudioComponentEndpointDto() { ConnectionType = "sdfdsgdfgd", DataKind = Shared.DataKind.Video, Id = 25, IOType = Shared.EndpointIOType.Output, Name = "rgjepaesfeü" }; var vm = new StudioComponentEndpointViewModel(null, dto); Assert.AreEqual(dto.Name, vm.Name); Assert.AreEqual(dto.IOType, vm.IOType); Assert.AreEqual(dto.Id, vm.Id); Assert.AreEqual(dto.DataKind, vm.DataKind); Assert.AreEqual(dto.ConnectionType, vm.ConnectionType); }
public void Adds_outputs_to_components() { var updater = new VirtualStudioViewModelUpdater(viewModel); var outputDto = new StudioComponentEndpointDto { Id = 25, IOType = Shared.EndpointIOType.Output, Name = "Ein Output", ConnectionType = "WebRTC", DataKind = Shared.DataKind.Video }; var placeholderInRepository = viewModel.ComponentRepository.Placeholders[0]; updater.AddOutputToComponent(virtualStudioName, placeholderInRepository.Id, outputDto); Check(placeholderInRepository.Outputs.First(i => i.Id == 25)); var clientInRepository = viewModel.ComponentRepository.Clients[0]; updater.AddOutputToComponent(virtualStudioName, clientInRepository.Id, outputDto); Check(clientInRepository.Outputs.First(i => i.Id == 25)); var placeholderInNodes = viewModel.ComponentNodes.First(c => c.Component is PlaceholderViewModel).Component; updater.AddOutputToComponent(virtualStudioName, placeholderInNodes.Id, outputDto); Check(placeholderInNodes.Outputs.First(i => i.Id == 25)); var clientInNodes = viewModel.ComponentNodes.First(c => c.Component is PlaceholderViewModel == false).Component; updater.AddOutputToComponent(virtualStudioName, clientInNodes.Id, outputDto); Check(clientInNodes.Outputs.First(i => i.Id == 25)); void Check(StudioComponentEndpointViewModel output) { Assert.IsTrue(output.IOType == Shared.EndpointIOType.Output); Assert.AreEqual(outputDto.Name, output.Name); Assert.AreEqual(outputDto.ConnectionType, output.ConnectionType); Assert.AreEqual(outputDto.DataKind, output.DataKind); Assert.IsNotNull(output.ComponentViewModel); } }
public Task <OperationResponse> AddOutputToPlaceholder(int componentId, StudioComponentEndpointDto output) => ExecuteOperation(new AddOutputToPlaceholderCommand(componentId, output));
public Task AddOutput(StudioComponentEndpointDto output) => hubConnection.InvokeAsync(nameof(AddOutput), output);
public Task AddOutput(StudioComponentEndpointDto output) => CallOnCurrentClient(c => c.AddOutput(output));
public Task AddInput(StudioComponentEndpointDto input) => CallOnCurrentClient(c => c.AddInput(input));
public AddOutputToPlaceholderCommand(int componentId, StudioComponentEndpointDto endpoint) { this.componentId = componentId; this.endpoint = endpoint; }
public Task AddOutputToComponent(string virtualStudioName, int componentId, StudioComponentEndpointDto endpoint) => GetGroup(virtualStudioName).AddOutputToComponent(virtualStudioName, componentId, endpoint);
public Task <OperationResponse> AddOutputToPlaceholder(int componentId, StudioComponentEndpointDto output) => InvokeIfConnected(() => HubConnection.InvokeAsync <OperationResponse>(nameof(AddOutputToPlaceholder), componentId, output));
public StudioComponentEndpointViewModel(ComponentViewModel componentViewModel, StudioComponentEndpointDto dto) : this(componentViewModel, dto.IOType, dto.Id, dto.DataKind, dto.ConnectionType) { Name = dto.Name; }