コード例 #1
0
        public void TestLyricsSiteFactory()
        {
            var lyricsSitesNames = LyricsSiteFactory.LyricsSitesNames();

            foreach (var lyricsSitesName in lyricsSitesNames)
            {
                Debug.WriteLine("Executing lyrics site " + lyricsSitesName);
                var abstractSite = LyricsSiteFactory.Create(lyricsSitesName, "U2", "With Or Without You", new ManualResetEvent(false), 5000);
                abstractSite.FindLyrics();
                // No assertions
            }
        }
コード例 #2
0
        private void RunSearchForSiteInThread(string lyricsSearchSiteName)
        {
            ThreadStart job = delegate
            {
                var lyricsSearchSite = LyricsSiteFactory.Create(lyricsSearchSiteName, _mArtist, _mTitle, _mEventStopSiteSearches, TimeLimitForSite);
                lyricsSearchSite.FindLyrics();
                if (_mAllowAllToComplete)
                {
                    ValidateSearchOutputForAllowAllToComplete(lyricsSearchSite.Lyric, lyricsSearchSiteName);
                }
                else
                {
                    ValidateSearchOutput(lyricsSearchSite.Lyric, lyricsSearchSiteName);
                }
            };
            var searchThread = new Thread(job);

            searchThread.Start();
        }
コード例 #3
0
        private void RunSearchForSiteInThread(string lyricsSearchSiteName)
        {
            // Moved the Create out of the Thread, since we sometimes got null returned
            var         lyricsSearchSite = LyricsSiteFactory.Create(lyricsSearchSiteName, _mArtist, _mTitle, _mEventStopSiteSearches, TimeLimitForSite);
            ThreadStart job = delegate
            {
                if (lyricsSearchSite != null)
                {
                    lyricsSearchSite.FindLyrics();
                    if (_mAllowAllToComplete)
                    {
                        ValidateSearchOutputForAllowAllToComplete(lyricsSearchSite.Lyric, lyricsSearchSiteName);
                    }
                    else
                    {
                        ValidateSearchOutput(lyricsSearchSite.Lyric, lyricsSearchSiteName);
                    }
                }
            };
            var searchThread = new Thread(job);

            searchThread.Start();
        }