public async Task GetStatus() { var audioEngine = new Mock <IAudioEngine>(); var settingsService = new Mock <ISettingsService>(); audioEngine.SetupGet(x => x.IsRunning).Returns(true); var processor = new EngineProcessor(audioEngine.Object, settingsService.Object); var result = await processor.ProcessAsync("getstatus", null).ConfigureAwait(false); audioEngine.VerifyGet(e => e.IsRunning, Times.Once); Assert.NotNull(result); Assert.True(result.IsSuccess); }
public async Task StopEngine() { var audioEngine = new Mock <IAudioEngine>(); audioEngine.Setup(e => e.Start()).Verifiable(); var settingsService = new Mock <ISettingsService>(); var processor = new EngineProcessor(audioEngine.Object, settingsService.Object); var result = await processor.ProcessAsync("stop", null).ConfigureAwait(false); audioEngine.Verify(e => e.Stop(), Times.Once); settingsService.Verify(e => e.SetSettingAsync(It.Is <string>(s => s == Globals.SettingKeys.IsEngineRunning), It.Is <bool>(x => x == false))); Assert.NotNull(result); Assert.True(result.IsSuccess); }