Exemplo n.º 1
0
        public void SearchWithJustTitleExpectResult()
        {
            var target   = OmdbSearchRequestBuilder.SearchTitle("The lord of the");
            var response = target.MakeRequest();

            var result = Task.Run(() => response).Result;

            Assert.IsTrue(result.Search.Count > 0);
            Assert.IsNotNull(result.Search.First().Title);
            Assert.IsTrue(result.Search.Where(r => r.Title.ToLower().Contains("the lord of the")).Count() > 0);
            Assert.IsNotNull(result.Search.First().ImdbId);
            Assert.IsNotNull(result.Search.First().Type);
            Assert.IsNotNull(result.Search.First().Year);
        }
Exemplo n.º 2
0
        static async void getMovies()
        {
            var searchTerm    = Console.ReadLine();
            var searchBuilder = OmdbSearchRequestBuilder.SearchTitle(searchTerm);
            var result        = await searchBuilder.MakeRequest();

            if (result != null)
            {
                foreach (var m in result.Search)
                {
                    Console.WriteLine(m.Title);
                    Console.WriteLine(m.Year);
                    Console.WriteLine(m.Type);
                    Console.WriteLine(m.imdbID);
                    Console.WriteLine(m.Poster);
                    Console.WriteLine("----------------------------------------------------");
                }
            }
        }