예제 #1
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);
                }
            }
예제 #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);
        }