Esempio n. 1
0
            public void CreatesEmptyTemporaryFile()
            {
                var fileSystem = new MockFileSystem();
                var metadata   = new NetworkSong();

                var song = MobileSong.Create(metadata, Observable.Never <byte[]>(), fileSystem);

                Assert.Equal(0, fileSystem.FileInfo.FromFileName(song.PlaybackPath).Length);
            }
Esempio n. 2
0
            public void StoresDataUponArrival()
            {
                var fileSystem = new MockFileSystem();
                var metadata   = new NetworkSong();
                var data       = new byte[] { 0, 1 };

                var song = MobileSong.Create(metadata, Observable.Return(data), fileSystem);

                Assert.Equal(data, fileSystem.File.ReadAllBytes(song.PlaybackPath));
            }
Esempio n. 3
0
            public void SetsTemporaryFileAsSongPath()
            {
                var fileSystem = new MockFileSystem();
                var metadata   = new NetworkSong();

                var song = MobileSong.Create(metadata, Observable.Never <byte[]>(), fileSystem);

                DirectoryInfoBase tempDir = fileSystem.DirectoryInfo.FromDirectoryName(fileSystem.Path.GetTempPath());

                Assert.Equal(song.OriginalPath, tempDir.GetFiles().First().FullName);
                Assert.Equal(song.PlaybackPath, tempDir.GetFiles().First().FullName);
            }
Esempio n. 4
0
            private void WaitsForSongData()
            {
                var metadata = new NetworkSong();
                var data     = new Subject <byte[]>();
                var song     = MobileSong.Create(metadata, data, new MockFileSystem());

                Task awaiter = song.PrepareAsync(YoutubeStreamingQuality.Low);

                Assert.False(awaiter.IsCompleted);

                data.OnNext(new byte[] { 0, 1 });
                data.OnCompleted();

                Assert.True(awaiter.IsCompleted);
            }