コード例 #1
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);
        }
コード例 #2
0
ファイル: LocalViewModelTest.cs プロジェクト: hur1can3/Espera
        public async Task ShowSongHelperMessageIsTrueForUpdatedLibrary()
        {
            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);
            }
        }
コード例 #3
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));
                }
            }
コード例 #4
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);
                }
            }
コード例 #5
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());
                }
            }