Example #1
0
            public async Task TriggersUpdate()
            {
                var fileSystem = new MockFileSystem();
                fileSystem.Directory.CreateDirectory("C://Test");

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

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

                    Guid token = library.LocalAccessControl.RegisterLocalAccessToken();

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

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

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

                    library.UpdateNow();

                    await updated.Timeout(TimeSpan.FromSeconds(5));
                }
            }