コード例 #1
0
            public void UniqueNameDoesValidate()
            {
                using (Library library = new LibraryBuilder().Build())
                {
                    Guid accessToken = library.LocalAccessControl.RegisterLocalAccessToken();
                    library.AddPlaylist("Existing", accessToken);
                    library.AddPlaylist("New", accessToken);

                    var fixture = new PlaylistViewModel(library.Playlists.Single(x => x.Name == "New"), library, accessToken, new CoreSettings());

                    fixture.EditName = true;
                    fixture.Name = "Unique";

                    Assert.Null(fixture["Name"]);
                }
            }
コード例 #2
0
        public void UpdateNowCommandCanExecuteSmokeTest()
        {
            var fileSystem = new MockFileSystem();
            fileSystem.Directory.CreateDirectory("C://Test");

            Library library = new LibraryBuilder().WithFileSystem(fileSystem).Build();
            Guid token = library.LocalAccessControl.RegisterLocalAccessToken();
            var vm = new SettingsViewModel(library, new ViewSettings(), new CoreSettings(), Substitute.For<IWindowManager>(), token,
                new MobileApiInfo(Observable.Return(new List<MobileClient>()), Observable.Return(false)));

            var coll = vm.UpdateLibraryCommand.CanExecuteObservable.CreateCollection();

            library.ChangeSongSourcePath("C://Test", token);

            var expected = new[] { false, true };

            Assert.Equal(expected, coll);
        }
コード例 #3
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
        public async Task CanPlayAWholeBunchOfSongs()
        {
            var song = new LocalSong("C://", TimeSpan.Zero);

            using (Library library = new LibraryBuilder().WithPlaylist().Build())
            {
                var awaiter = library.PlaybackState.Where(x => x == AudioPlayerState.Playing)
                    .Select((x, i) => i + 1)
                    .FirstAsync(x => x == 10)
                    .PublishLast();
                awaiter.Connect();

                Guid token = library.LocalAccessControl.RegisterLocalAccessToken();

                await library.PlayInstantlyAsync(Enumerable.Repeat(song, 10).ToList(), token);

                await awaiter.Timeout(TimeSpan.FromSeconds(5));
            }
        }
コード例 #4
0
            public async Task NullUriThrowsArgumentNullException()
            {
                const string youtubePath = "http://youtube.com?v=yadda";
                var song = new YoutubeSong(youtubePath, TimeSpan.FromMinutes(1));
                var songFinder = Substitute.For<IYoutubeSongFinder>();
                songFinder.ResolveYoutubeSongFromUrl(Arg.Any<Uri>()).Returns(Task.FromResult(song));

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

                    var playlist = library.Playlists.First();
                    library.SwitchToPlaylist(playlist, accessToken);

                    var fixture = new DirectYoutubeViewModel(library, accessToken, songFinder);

                    await Helpers.ThrowsAsync<ArgumentNullException>(() => fixture.AddDirectYoutubeUrlToPlaylist(null, null));
                }
            }
コード例 #5
0
            public async Task NullYoutubeSongFinderResultDoesNothing()
            {
                var songFinder = Substitute.For<IYoutubeSongFinder>();
                songFinder.ResolveYoutubeSongFromUrl(Arg.Any<Uri>()).Returns(Task.FromResult<YoutubeSong>(null));

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

                    var playlist = library.Playlists.First();
                    library.SwitchToPlaylist(playlist, accessToken);

                    var fixture = new DirectYoutubeViewModel(library, accessToken, songFinder);

                    await fixture.AddDirectYoutubeUrlToPlaylist(new Uri("http://youtube.com?v=yadda"), null);

                    Assert.Equal(0, playlist.Count());
                }
            }
コード例 #6
0
            public async Task SmokeTest()
            {
                const string youtubePath = "http://youtube.com?v=yadda";
                var song = new YoutubeSong(youtubePath, TimeSpan.FromMinutes(1));
                var songFinder = Substitute.For<IYoutubeSongFinder>();
                songFinder.ResolveYoutubeSongFromUrl(Arg.Any<Uri>()).Returns(Task.FromResult(song));

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

                    var playlist = library.Playlists.First();
                    library.SwitchToPlaylist(playlist, accessToken);

                    var fixture = new DirectYoutubeViewModel(library, accessToken, songFinder);

                    await fixture.AddDirectYoutubeUrlToPlaylist(new Uri(youtubePath), null);

                    Assert.Equal(1, playlist.Count());
                }
            }
コード例 #7
0
            public async Task IsTrueForUpdatedLibrary()
            {
                var song = new LocalSong("C://Song.mp3", TimeSpan.Zero);

                var songFinder = Substitute.For<ILocalSongFinder>();
                songFinder.GetSongsAsync().Returns(Observable.Return(Tuple.Create(song, (byte[])null)));

                var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData> { { "C://Song.mp3", new MockFileData("Bla") } });

                using (Library library = new LibraryBuilder().WithFileSystem(fileSystem).WithSongFinder(songFinder).Build())
                {
                    Guid accessToken = library.LocalAccessControl.RegisterLocalAccessToken();

                    // NB: System.IO.Abstractions only likes backslashes
                    library.ChangeSongSourcePath("C:\\", accessToken);

                    var vm = new LocalViewModel(library, new ViewSettings(), new CoreSettings(), accessToken);

                    await library.AwaitInitializationAndUpdate();

                    Assert.False(vm.ShowAddSongsHelperMessage);
                }
            }
コード例 #8
0
        public void PartyModeTriggersTimeoutMessage()
        {
            using (var library = new LibraryBuilder().WithPlaylist().Build())
            {
                Guid accessToken = library.LocalAccessControl.RegisterLocalAccessToken();
                library.LocalAccessControl.SetLocalPassword(accessToken, "password");
                library.LocalAccessControl.DowngradeLocalAccess(accessToken);

                var fixture = Substitute.For<SongSourceViewModel<ISongViewModelBase>>(library, accessToken);

                var timeoutTriggers = fixture.TimeoutWarning.CreateCollection();

                var songVm = Substitute.For<ISongViewModelBase>();
                var song = Helpers.SetupSongMock();
                songVm.Model.Returns(song);

                fixture.SelectedSongs = new[] { songVm };

                fixture.AddToPlaylistCommand.Execute(null);
                fixture.AddToPlaylistCommand.Execute(null);

                Assert.Equal(1, timeoutTriggers.Count);
            }
        }
コード例 #9
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
            public async Task UpdateRemovesArtworkOnlyWithoutReferenceToSong()
            {
                var existingSong = new LocalSong("C://Existing.mp3", TimeSpan.Zero, "artwork-abcdefg");
                var missingSong = new LocalSong("C://Missing.mp3", TimeSpan.Zero, "artwork-abcdefg");
                await BlobCache.LocalMachine.Insert("artwork-abcdefg", new byte[] { 0, 1 });

                var libraryReader = Substitute.For<ILibraryReader>();
                libraryReader.LibraryExists.Returns(true);
                libraryReader.ReadSongSourcePath().Returns("C://");
                libraryReader.ReadPlaylists().Returns(new List<Playlist>());
                libraryReader.ReadSongs().Returns(new[] { existingSong, missingSong });

                var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData> { { existingSong.OriginalPath, new MockFileData("DontCare") } });

                using (Library library = new LibraryBuilder().WithFileSystem(fileSystem).WithReader(libraryReader).Build())
                {
                    await library.AwaitInitializationAndUpdate();

                    Assert.NotNull(BlobCache.LocalMachine.GetAllKeys().FirstOrDefault(x => x == "artwork-abcdefg"));
                }
            }
コード例 #10
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
            public void ThrowsAccessExceptionIfPartyModeAndLockPlaylistSwitchingIsTrue()
            {
                var settings = new CoreSettings
                {
                    LockPlaylist = true
                };

                using (Library library = new LibraryBuilder().WithPlaylist("Playlist 1").WithSettings(settings).Build())
                {
                    Guid token = library.LocalAccessControl.RegisterLocalAccessToken();

                    library.AddPlaylist("Playlist 2", token);

                    library.LocalAccessControl.SetLocalPassword(token, "Password");
                    library.LocalAccessControl.DowngradeLocalAccess(token);

                    Assert.Throws<AccessException>(() => library.SwitchToPlaylist(library.GetPlaylistByName("Playlist 2"), token));
                }
            }
コード例 #11
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
            public async Task ExternalTagChangesArePropagated()
            {
                var song = new LocalSong("C://Song.mp3", TimeSpan.Zero) { Title = "A" };
                var updatedSong = new LocalSong("C://Song.mp3", TimeSpan.Zero) { Title = "B" };

                var libraryReader = Substitute.For<ILibraryReader>();
                libraryReader.LibraryExists.Returns(true);
                libraryReader.ReadSongSourcePath().Returns("C://");
                libraryReader.ReadPlaylists().Returns(new List<Playlist>());
                libraryReader.ReadSongs().Returns(new[] { song });

                var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData> { { song.OriginalPath, new MockFileData("DontCare") } });

                var songFinder = Substitute.For<ILocalSongFinder>();
                songFinder.GetSongsAsync().Returns(Observable.Return(Tuple.Create(updatedSong, (byte[])null)));

                using (Library library = new LibraryBuilder().WithFileSystem(fileSystem).WithReader(libraryReader).WithSongFinder(songFinder).Build())
                {
                    await library.AwaitInitializationAndUpdate();

                    Assert.Equal("B", library.Songs[0].Title);
                }
            }
コード例 #12
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
            public async Task PreventsNextSongFromPlaying()
            {
                var audioPlayerCallback = Substitute.For<IMediaPlayerCallback>();

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

                    int played = 0;

                    audioPlayerCallback.PlayAsync().Returns(Task.Run(() =>
                    {
                        if (played == 0)
                        {
                            library.AddAndSwitchToPlaylist("Playlist2", token);
                        }

                        played++;
                    }));

                    library.AddSongsToPlaylist(Helpers.SetupSongMocks(2), token);

                    await library.PlaySongAsync(0, token);

                    Assert.Equal(1, played);
                }
            }
コード例 #13
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
            public async Task SetsCurrentSongIndexIfChangingToOtherPlaylistAndPlayingFirstSong()
            {
                var settings = new CoreSettings
                {
                    EnablePlaylistTimeout = false
                };

                using (Library library = new LibraryBuilder().WithPlaylist().WithSettings(settings).Build())
                {
                    var coll = library.CurrentPlaylistChanged.StartWith(library.CurrentPlaylist)
                        .Select(x => x.WhenAnyValue(y => y.CurrentSongIndex)).Switch().CreateCollection();

                    Guid token = library.LocalAccessControl.RegisterLocalAccessToken();

                    library.AddSongToPlaylist(Helpers.SetupSongMock());

                    await library.PlaySongAsync(0, token);

                    library.AddPlaylist("Playlist 2", token);
                    library.SwitchToPlaylist(library.Playlists.Last(), token);
                    library.AddSongToPlaylist(Helpers.SetupSongMock());

                    await library.PlaySongAsync(0, token);

                    Assert.Equal(new int?[] { null, 0, null, null, 0, null }, coll);
                }
            }
コード例 #14
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
            public async Task SmokeTest()
            {
                var fileSystem = new MockFileSystem();
                fileSystem.Directory.CreateDirectory("C://Test");

                using (Library library = new LibraryBuilder().WithFileSystem(fileSystem).Build())
                {
                    library.ChangeSongSourcePath("C://Test", library.LocalAccessControl.RegisterLocalAccessToken());
                    Assert.Equal("C://Test", await library.SongSourcePath.FirstAsync());
                }
            }
コード例 #15
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
            public async Task JumpsOverCorruptedSong()
            {
                using (var handle = new CountdownEvent(2))
                {
                    var audioPlayer = Substitute.For<IMediaPlayerCallback>();
                    audioPlayer.PlayAsync().Returns(_ => Task.Run(() =>
                    {
                        switch (handle.CurrentCount)
                        {
                            case 2:
                                handle.Signal();
                                throw new SongLoadException();
                            case 1:
                                handle.Signal();
                                break;
                        }
                    }));

                    using (Library library = new LibraryBuilder().WithPlaylist().WithAudioPlayer(audioPlayer).Build())
                    {
                        Song[] songs = Helpers.SetupSongMocks(2);

                        await library.PlayInstantlyAsync(songs, library.LocalAccessControl.RegisterLocalAccessToken());

                        if (!handle.Wait(5000))
                        {
                            Assert.False(true, "Timeout");
                        }
                    }
                }
            }
コード例 #16
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
            public async Task SmokeTest()
            {
                var fileSystem = new MockFileSystem();
                fileSystem.Directory.CreateDirectory("C://Test");

                using (var library = new LibraryBuilder().WithFileSystem(fileSystem).Build())
                {
                    Guid token = library.LocalAccessControl.RegisterLocalAccessToken();

                    library.ChangeSongSourcePath("C://Test", token);

                    var isUpdating = library.IsUpdating.CreateCollection();

                    var last = library.IsUpdating.Where(x => !x).ElementAt(1).PublishLast();
                    last.Connect();

                    library.Initialize();

                    await last.Timeout(TimeSpan.FromSeconds(5));

                    Assert.Equal(new[] { false, true, false }, isUpdating);
                }
            }
コード例 #17
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
            public void PlaylistTimeoutThrowsInvalidOperationException()
            {
                using (Library library = new LibraryBuilder().WithPlaylist().Build())
                {
                    Guid accessToken = library.LocalAccessControl.RegisterLocalAccessToken();
                    library.LocalAccessControl.SetLocalPassword(accessToken, "password");
                    library.LocalAccessControl.DowngradeLocalAccess(accessToken);

                    Song song = Helpers.SetupSongMock();

                    library.AddSongToPlaylist(song);
                    Assert.Throws<InvalidOperationException>(() => library.AddSongToPlaylist(song));
                }
            }
コード例 #18
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
            public async Task SetsSongIsCorruptedToTrueIfFailing()
            {
                Func<Library, Task> test = async library =>
                {
                    Song song = Helpers.SetupSongMock();

                    library.AddSongToPlaylist(song);

                    await library.PlaySongAsync(0, library.LocalAccessControl.RegisterLocalAccessToken());

                    Assert.True(song.IsCorrupted);
                };

                var audioPlayerCallback = Substitute.For<IMediaPlayerCallback>();
                audioPlayerCallback.LoadAsync(Arg.Any<Uri>()).Returns(Observable.Throw<Unit>(new SongLoadException()).ToTask());

                using (Library library = new LibraryBuilder().WithPlaylist().WithAudioPlayer(audioPlayerCallback).Build())
                {
                    await test(library);
                }

                audioPlayerCallback.PlayAsync().Returns(Observable.Throw<Unit>(new PlaybackException()).ToTask());
                using (Library library = new LibraryBuilder().WithPlaylist().WithAudioPlayer(audioPlayerCallback).Build())
                {
                    await test(library);
                }
            }
コード例 #19
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
            public async Task SongPreparationCanTimeout()
            {
                await new TestScheduler().With(async sched =>
                {
                    var song = Substitute.For<Song>("C://", TimeSpan.Zero);
                    song.PrepareAsync(Arg.Any<YoutubeStreamingQuality>()).Returns(Observable.Return(Unit.Default)
                        .Delay(Library.PreparationTimeout + TimeSpan.FromSeconds(1), sched).ToTask());

                    var audioPlayerCallback = Substitute.For<IMediaPlayerCallback>();

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

                        library.AddSongsToPlaylist(new[] { song }, token);

                        Task play = library.PlaySongAsync(0, token);

                        sched.AdvanceByMs((Library.PreparationTimeout + TimeSpan.FromSeconds(2)).TotalMilliseconds);

                        await play;
                    }

                    audioPlayerCallback.DidNotReceiveWithAnyArgs().LoadAsync(Arg.Any<Uri>());
                });
            }
コード例 #20
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
            public async Task PlaysNextSongAutomatically()
            {
                using (Library library = new LibraryBuilder().WithPlaylist().Build())
                {
                    Guid token = library.LocalAccessControl.RegisterLocalAccessToken();

                    library.AddSongsToPlaylist(Helpers.SetupSongMocks(2), token);

                    var conn = library.PlaybackState.Where(x => x == AudioPlayerState.Playing)
                        .Take(2)
                        .PublishLast();
                    conn.Connect();

                    await library.PlaySongAsync(0, token);

                    await conn.Timeout(TimeSpan.FromSeconds(5));
                }
            }
コード例 #21
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
 public async Task ThrowsInvalidOperationExceptionIfPlaylistIsEmpty()
 {
     using (Library library = new LibraryBuilder().WithPlaylist().Build())
     {
         await Helpers.ThrowsAsync<InvalidOperationException>(async () => await library.PlayPreviousSongAsync(library.LocalAccessControl.RegisterLocalAccessToken()));
     }
 }
コード例 #22
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
            public async Task SmokeTest()
            {
                var audioPlayer = Substitute.For<IMediaPlayerCallback>();

                using (Library library = new LibraryBuilder().WithAudioPlayer(audioPlayer).Build())
                {
                    Song song = Helpers.SetupSongMock();

                    await library.PlayInstantlyAsync(new[] { song }, library.LocalAccessControl.RegisterLocalAccessToken());
                }

                audioPlayer.Received(1).PlayAsync();
            }
コード例 #23
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
            public async Task UpdateRemovesArtworkWhenSongIsMissing()
            {
                var missingSong = new LocalSong("C://Missing.mp3", TimeSpan.Zero, "artwork-abcdefg");
                await BlobCache.LocalMachine.Insert("artwork-abcdefg", new byte[] { 0, 1 });

                var libraryReader = Substitute.For<ILibraryReader>();
                libraryReader.LibraryExists.Returns(true);
                libraryReader.ReadSongSourcePath().Returns("C://");
                libraryReader.ReadPlaylists().Returns(new List<Playlist>());
                libraryReader.ReadSongs().Returns(new[] { missingSong });

                var fileSystem = new MockFileSystem();
                fileSystem.Directory.CreateDirectory("C://");

                using (Library library = new LibraryBuilder().WithFileSystem(fileSystem).WithReader(libraryReader).Build())
                {
                    await library.AwaitInitializationAndUpdate();

                    Assert.Null(BlobCache.LocalMachine.GetAllKeys().FirstOrDefault(x => x == "artwork-abcdefg"));
                }
            }
コード例 #24
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
            public async Task WhileSongIsPlayingStopsCurrentSong()
            {
                using (Library library = new LibraryBuilder().WithPlaylist().Build())
                {
                    Guid token = library.LocalAccessControl.RegisterLocalAccessToken();

                    library.AddSongsToPlaylist(Helpers.SetupSongMocks(1), token);

                    var awaiter = library.PlaybackState.FirstAsync(x => x == AudioPlayerState.Finished).PublishLast();
                    awaiter.Connect();

                    await library.PlaySongAsync(0, token);

                    library.RemoveFromPlaylist(new[] { 0 }, token);

                    await awaiter.Timeout(TimeSpan.FromSeconds(5));
                }
            }
コード例 #25
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
            public async Task TriggersUpdate()
            {
                var fileSystem = new MockFileSystem();
                fileSystem.Directory.CreateDirectory("C://Test");

                using (var library = new LibraryBuilder().WithFileSystem(fileSystem).Build())
                {
                    library.Initialize();

                    var updated = library.IsUpdating.FirstAsync(x => x).PublishLast();
                    updated.Connect();

                    Guid token = library.LocalAccessControl.RegisterLocalAccessToken();

                    library.ChangeSongSourcePath("C://Test", token);

                    await updated.Timeout(TimeSpan.FromSeconds(5));
                }
            }
コード例 #26
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
            public async Task DoesNotSaveTemporaryPlaylist()
            {
                var libraryWriter = Substitute.For<ILibraryWriter>();

                using (Library library = new LibraryBuilder().WithWriter(libraryWriter).Build())
                {
                    Guid token = library.LocalAccessControl.RegisterLocalAccessToken();

                    library.AddAndSwitchToPlaylist("Playlist", token);

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

                    library.Save();
                }

                libraryWriter.Received(1).Write(Arg.Any<IEnumerable<LocalSong>>(), Arg.Is<IEnumerable<Playlist>>(x => x.Count() == 1), Arg.Any<string>());
            }
コード例 #27
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
            public void ThrowsAccessExceptionIfAccessModeIsPartyAndLockPlaylistRemovalIsTrue()
            {
                var songMock = Substitute.For<Song>("TestPath", TimeSpan.Zero);

                var settings = new CoreSettings
                {
                    LockPlaylist = true
                };

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

                    library.AddSongToPlaylist(songMock);

                    Assert.Throws<AccessException>(() => library.RemoveFromPlaylist(new[] { 0 }, token));
                }
            }
コード例 #28
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
            public async Task CallsAudioPlayerPause()
            {
                var audioPlayerCallback = Substitute.For<IMediaPlayerCallback>();

                using (Library library = new LibraryBuilder().WithPlaylist().WithAudioPlayer(audioPlayerCallback).Build())
                {
                    Song song = Helpers.SetupSongMock();

                    library.AddSongToPlaylist(song);

                    Guid token = library.LocalAccessControl.RegisterLocalAccessToken();

                    await library.PlaySongAsync(0, token);

                    await library.PauseSongAsync(token);
                }

                audioPlayerCallback.Received(1).PauseAsync();
            }
コード例 #29
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
            public void BySongReferenceTest()
            {
                using (Library library = new LibraryBuilder().WithPlaylist().Build())
                {
                    Guid token = library.LocalAccessControl.RegisterLocalAccessToken();

                    Song[] songs = Helpers.SetupSongMocks(4);

                    library.AddSongsToPlaylist(songs, token);

                    library.RemoveFromPlaylist(new[] { songs[0], songs[2] }, token);

                    Song[] remaining = library.CurrentPlaylist.Select(entry => entry.Song).ToArray();

                    Assert.Equal(songs[1], remaining[0]);
                    Assert.Equal(songs[3], remaining[1]);
                }
            }
コード例 #30
0
ファイル: LibraryTest.cs プロジェクト: hur1can3/Espera
            public void DisabledTimeoutSmokeTest()
            {
                var settings = new CoreSettings
                {
                    EnablePlaylistTimeout = false
                };

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

                    Song song = Helpers.SetupSongMock();

                    library.AddSongToPlaylist(song);
                    library.AddSongToPlaylist(song);

                    Assert.Equal(2, library.CurrentPlaylist.Count());
                }
            }