public void PlayFirstElement() { const string elementId = "eID"; const string sourceId = "ID1"; var element = new EnvironmentElement { Id = elementId, Positioning = new Positioning { FixedPosition = new Position() }, Timing = new Timing { MinStartDelay = TimeSpan.FromMinutes(0), MaxStartDelay = TimeSpan.FromMinutes(0) }, Audio = new AudioComponent { Playlist = new ElementPlaylist { Order = SourceOrder.InOrder, Repeat = SourceRepeatMode.None, Descriptors = new[] { sourceId } } } }; var state = new EncounterStateElement { ElementId = elementId, StartsWithState = true }; var audio = new Mock <IAudioService> (); var storage = new Mock <ILocalStorageService> (); var effect = new TestEffect(TimeSpan.FromSeconds(30)); audio.Setup(a => a.PrepareEffectAsync(It.IsAny <EnvironmentElement> (), It.IsAny <string> (), It.IsAny <PlaybackOptions> ())) .ReturnsAsync(effect); var environmentElement = new PlaybackEnvironmentElement(state, element); environmentElement.Tick(new ActiveServices { Audio = audio.Object, Storage = storage.Object }); audio.Verify(a => a.PrepareEffectAsync(element, sourceId, It.IsAny <PlaybackOptions> ())); audio.Verify(a => a.PlayEffect(effect)); }
public PlaybackEnvironmentElement(EncounterStateElement stateElement, EnvironmentElement element) { StateElement = stateElement ?? throw new ArgumentNullException(nameof(stateElement)); Element = element ?? throw new ArgumentNullException(nameof(element)); IsActive = StateElement.StartsWithState; Intensity = StateElement.Intensity; foreach (EnvironmentComponent component in Element.GetComponents()) { this.componentStates.Add(new ComponentState { Component = component, IsActive = stateElement.StartsWithState, LastIntensity = stateElement.Intensity }); } }
public RunEnvironmentElementViewModel(IAsyncServiceProvider serviceProvider, ISyncService syncService, EncounterStateElement element) : base(serviceProvider, syncService, element.ElementId) { StateElement = element ?? throw new ArgumentNullException(nameof(element)); Load(); }