Example #1
0
            public void PropagatesToSettings()
            {
                var settings = new CoreSettings
                {
                    Volume = 0.0f
                };

                using (Library library = new LibraryBuilder().WithSettings(settings).Build())
                {
                    Guid accessToken = library.LocalAccessControl.RegisterLocalAccessToken();

                    library.SetVolume(0.5f, accessToken);
                }

                Assert.Equal(0.5f, settings.Volume);
            }
Example #2
0
            public void VerifiesAccessRights()
            {
                var settings = new CoreSettings
                {
                    LockVolume = false
                };

                using (Library library = new LibraryBuilder().WithSettings(settings).Build())
                {
                    Guid accessToken = library.LocalAccessControl.RegisterLocalAccessToken();
                    library.LocalAccessControl.SetLocalPassword(accessToken, "Password");
                    library.LocalAccessControl.DowngradeLocalAccess(accessToken);

                    library.SetVolume(0.5f, accessToken);

                    library.LocalAccessControl.UpgradeLocalAccess(accessToken, "Password");
                    settings.LockVolume = true;
                    library.LocalAccessControl.DowngradeLocalAccess(accessToken);

                    Assert.Throws<AccessException>(() => library.SetVolume(0.5f, accessToken));
                }
            }
Example #3
0
            public async Task PropagatesToMediaPlayer()
            {
                var audioPlayer = Substitute.For<IMediaPlayerCallback>();

                using (Library library = new LibraryBuilder().WithAudioPlayer(audioPlayer).WithPlaylist().Build())
                {
                    Guid accessToken = library.LocalAccessControl.RegisterLocalAccessToken();

                    await library.PlayInstantlyAsync(Helpers.SetupSongMocks(1), accessToken);

                    library.SetVolume(0.5f, accessToken);
                }

                audioPlayer.Received().SetVolume(0.5f);
            }