Пример #1
0
        public async Task SpeakCallsCorrectServiceCall()
        {
            // ARRANGE
            DefaultDaemonHost.InternalDelayTimeForTts = 0; // For testing

            // ACT
            await DefaultDaemonApp
            .MediaPlayer("media_player.correct_player")
            .Speak("a message")
            .ExecuteAsync();

            var(daemonTask, _) = ReturnRunningDefauldDaemonHostTask();

            await Task.Delay(20);

            var     expObject           = new ExpandoObject();
            dynamic expectedAttruibutes = expObject;

            expectedAttruibutes.entity_id = "media_player.correct_player";
            expectedAttruibutes.message   = "a message";

            // ASSERT
            DefaultHassClientMock.Verify(n => n.CallService("tts", "google_cloud_say", expObject, true));

            await WaitUntilCanceled(daemonTask);
        }
Пример #2
0
        public async Task SpeakCallsCorrectServiceCall()
        {
            await InitializeFakeDaemon().ConfigureAwait(false);

            // ARRANGE
            DefaultDaemonHost.InternalDelayTimeForTts = 0; // For testing

            // ACT
            await DefaultDaemonApp
            .MediaPlayer("media_player.correct_player")
            .Speak("a message")
            .ExecuteAsync();

            await Task.Delay(20);

            var     expObject           = new FluentExpandoObject();
            dynamic expectedAttruibutes = expObject;

            expectedAttruibutes.entity_id = "media_player.correct_player";
            expectedAttruibutes.message   = "a message";

            // ASSERT
            VerifyCallService("tts", "google_cloud_say", expObject, true);
            // Verify(n => n.CallService("tts", "google_cloud_say", expObject, true));

            await RunFakeDaemonUntilTimeout().ConfigureAwait(false);
        }
Пример #3
0
        public async Task MediaPlayerStopCallsCorrectServiceCall()
        {
            // ARRANGE
            // ACT
            await DefaultDaemonApp
            .MediaPlayer("media_player.player")
            .Stop()
            .ExecuteAsync();

            // ASSERT
            DefaultHassClientMock.VerifyCallServiceTimes("media_stop", Times.Once());
            DefaultHassClientMock.VerifyCallService("media_player", "media_stop", ("entity_id", "media_player.player"));
        }
Пример #4
0
        public async Task MediaPlayerPlayPauseCallsCorrectServiceCall()
        {
            // ARRANGE
            // ACT
            await DefaultDaemonApp
            .MediaPlayer("media_player.player")
            .PlayPause()
            .ExecuteAsync();

            // ASSERT
            VerifyCallServiceTimes("media_play_pause", Times.Once());
            VerifyCallServiceTuple("media_player", "media_play_pause", ("entity_id", "media_player.player"));
        }