4 instantiations of Interaction
Aspire.Hosting (4)
InteractionService.cs (4)
125var newState = new Interaction(title, message, options, new Interaction.MessageBoxInteractionInfo(intent: options.Intent ?? MessageIntent.None), interactionCts.Token); 199var newState = new Interaction(title, message, options, new Interaction.InputsInteractionInfo(inputCollection), interactionCts.Token); 278var newState = new Interaction(title, message, options, new Interaction.NotificationInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), interactionCts.Token); 345var newState = new Interaction(title, message, options, interactionInfo, interactionCts.Token);
112 references to Interaction
Aspire.Hosting (48)
Dashboard\DashboardService.cs (2)
15using static Aspire.Hosting.Interaction; 104await foreach (var interaction in updates.WithCancellation(cts.Token).ConfigureAwait(false))
Dashboard\DashboardServiceData.cs (5)
154internal IAsyncEnumerable<Interaction> SubscribeInteractionUpdates() 213if (interaction.InteractionInfo is not Interaction.TerminalInteractionInfo terminal || 220var inputsInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 251Interaction.InputsInteractionInfo inputsInfo, 307public static void ProcessInputs(IServiceProvider serviceProvider, ILogger logger, Interaction.InputsInteractionInfo inputsInfo, List<InputDto> inputDtos, bool dependencyChange, CancellationToken cancellationToken)
InteractionService.cs (34)
27private Action<Interaction>? OnInteractionUpdated { get; set; } 125var newState = new Interaction(title, message, options, new Interaction.MessageBoxInteractionInfo(intent: options.Intent ?? MessageIntent.None), interactionCts.Token); 199var newState = new Interaction(title, message, options, new Interaction.InputsInteractionInfo(inputCollection), interactionCts.Token); 278var newState = new Interaction(title, message, options, new Interaction.NotificationInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), interactionCts.Token); 299options.Title ?? string.Empty, message, options, new Interaction.ProgressInteractionInfo(), 329options.Title ?? string.Empty, message, options, new Interaction.TerminalInteractionInfo(terminal.Id), 335string title, string message, InteractionOptions options, Interaction.InteractionInfoBase interactionInfo, 345var newState = new Interaction(title, message, options, interactionInfo, interactionCts.Token); 411private void CompleteWorkInteraction(Interaction interaction, InteractionCompletionState completion) 441internal List<Interaction> GetCurrentInteractions() 451var interactionState = (Interaction)newState!; 465private void AddInteractionUpdate(Interaction interactionUpdate) 471if (interactionUpdate.State == Interaction.InteractionState.Complete) 499internal void UpdateInteraction(Interaction interaction) 504if (!_interactionCollection.TryGetValue(interaction.InteractionId, out var interactionState)) 514internal async Task ProcessInteractionFromClientAsync(int interactionId, Func<Interaction, IServiceProvider, ILogger, InteractionCompletionState> createResult, CancellationToken cancellationToken) 516Interaction? interactionState = null; 556private void CompleteInteractionCore(Interaction interactionState, InteractionCompletionState completion) 560if (interactionState.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo && 573interactionState.State = Interaction.InteractionState.Complete; 585private async Task<bool> RunValidationAsync(Interaction interactionState, InteractionCompletionState result, CancellationToken cancellationToken) 587if (result.Complete && interactionState.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo) 689internal async IAsyncEnumerable<Interaction> SubscribeInteractionUpdates([EnumeratorCancellation] CancellationToken cancellationToken = default) 691var channel = Channel.CreateUnbounded<Interaction>(); 693void WriteToChannel(Interaction resourceEvent) => 696List<Interaction> pendingInteractions; 705foreach (var interaction in pendingInteractions) 712await foreach (var item in channel.Reader.ReadAllAsync(cancellationToken).ConfigureAwait(false)) 737internal class InteractionCollection : KeyedCollection<int, Interaction> 739protected override int GetKeyForItem(Interaction item) => item.InteractionId;
Pipelines\PipelineActivityReporter.cs (7)
314await foreach (var interaction in _interactionService.SubscribeInteractionUpdates(cancellationToken).ConfigureAwait(false)) 325private async Task WriteInteractionUpdateToClientAsync(Interaction interaction, CancellationToken cancellationToken) 327if (interaction.State == Interaction.InteractionState.InProgress) 329if (interaction.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo && inputsInfo.Inputs.Count > 0) 370else if (interaction.InteractionInfo is Interaction.NotificationInteractionInfo) 410if (interaction.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo) 456else if (interaction.InteractionInfo is Interaction.NotificationInteractionInfo)
Aspire.Hosting.Tests (64)
Dashboard\DashboardServiceTests.cs (4)
657var interaction = Assert.Single(interactions.GetCurrentInteractions()); 1200var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1238var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1302var interaction = Assert.Single(interactionService.GetCurrentInteractions());
InteractionServiceTests.cs (47)
30var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 32Assert.Equal(Interaction.InteractionState.InProgress, interaction.State); 55var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 57Assert.Equal(Interaction.InteractionState.InProgress, interaction.State); 126var updates = Channel.CreateUnbounded<Interaction>(); 129await foreach (var interaction in subscription.WithCancellation(CancellationToken.None)) 137var interaction1 = Assert.Single(interactionService.GetCurrentInteractions()); 142var interaction2 = interactionService.GetCurrentInteractions()[1]; 150var completedInteraction1 = await updates.Reader.ReadAsync().DefaultTimeout(); 158var completedInteraction2 = await updates.Reader.ReadAsync().DefaultTimeout(); 376var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 378Assert.Equal(Interaction.InteractionState.InProgress, interaction.State); 402var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 425var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 448var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 469var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 492var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 525var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 862var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 899var updates = Channel.CreateUnbounded<Interaction>(); 902await foreach (var interaction in subscription.WithCancellation(CancellationToken.None)) 929var interaction = await updates.Reader.ReadAsync().DefaultTimeout(); 930var inputsInteractionInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 939inputsInteractionInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 952var updates = Channel.CreateUnbounded<Interaction>(); 955await foreach (var interaction in subscription.WithCancellation(CancellationToken.None)) 984var interaction = await updates.Reader.ReadAsync().DefaultTimeout(); 985var inputsInteractionInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 998inputsInteractionInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 1005inputsInteractionInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 1045var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1173var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1209var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1259var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1260Assert.Equal(Interaction.InteractionState.InProgress, interaction.State); 1282var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1300var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1303Assert.IsType<Interaction.ProgressInteractionInfo>(interaction.InteractionInfo); 1315if (interaction.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo) 1355var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1383var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1408var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1427var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1451var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1475var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1498var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1527var interaction = Assert.Single(interactionService.GetCurrentInteractions());
ResourceCommandServiceTests.cs (2)
1370var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1371var inputs = Assert.IsType<Interaction.InputsInteractionInfo>(interaction.InteractionInfo).Inputs;
Terminals\InteractionServiceTerminalTests.cs (11)
120var interaction = Assert.Single(service.GetCurrentInteractions()); 164var interaction = Assert.Single(service.GetCurrentInteractions()); 165Assert.Equal(terminal.Id, Assert.IsType<Interaction.TerminalInteractionInfo>(interaction.InteractionInfo).TerminalId); 207var interaction = Assert.Single(service.GetCurrentInteractions()); 243var interaction = Assert.Single(service.GetCurrentInteractions()); 292Assert.Equal(Interaction.InteractionState.InProgress, updates.Current.State); 308var interaction = updates.Current; 324Assert.Equal(Interaction.InteractionState.Complete, updates.Current.State); 333Assert.Equal(Interaction.InteractionState.InProgress, updates.Current.State); 371var interaction = Assert.Single(service.GetCurrentInteractions()); 402var interaction = Assert.Single(service.GetCurrentInteractions());