Esempio n. 1
0
        public async Task TestIdleAsync()
        {
            var taskCompletionSource = new TaskCompletionSource <bool>();

            using (var statusClient = await MpdStateMonitor.CreateAsync(_host, _port))
            {
                statusClient.StateChanged += (sender, args) =>
                {
                    Log.Info().WriteLine("Subsystem changed {0}", args.ChangedSubsystem);
                    taskCompletionSource.SetResult(true);
                };
                using (var controlClient = await MpdClient.CreateAsync(_host, _port))
                {
                    var status = await controlClient.StatusAsync();

                    await controlClient.PauseAsync(status.PlayState == PlayStates.Playing);

                    status = await controlClient.StatusAsync();

                    await controlClient.PauseAsync(status.PlayState == PlayStates.Playing);
                }
                // Using the delay with the token causes a TaskCanceledException
                await taskCompletionSource.Task;
            }
        }
Esempio n. 2
0
        public async Task TestStatusAsync()
        {
            using (var client = await MpdClient.CreateAsync(_host, _port))
            {
                var status = await client.StatusAsync();

                Assert.NotNull(status.Audioformat);
                Assert.Equal("44100:16:2", status.Audioformat);
            }
        }