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); }
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); } }
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)); } }
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); } }
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()); } }