Ejemplo n.º 1
0
        private KanyeQuoteModel getKanyeQuote()
        {
            var mockKanyeQuote = new KanyeQuoteModel
            {
                Quote = "I aint saying shes a golddigger"
            };

            return(mockKanyeQuote);
        }
Ejemplo n.º 2
0
        public void Run()
        {
            string content       = string.Empty;
            string kanyeQuoteUrl = @"https://api.kanye.rest/";

            using (var wc = new WebClient())
            {
                content = wc.DownloadString(kanyeQuoteUrl);
            }
            KanyeQuoteModel kanyeQuote = JsonSerializer.Deserialize <KanyeQuoteModel>(content);

            Console.WriteLine($"\n{kanyeQuote.Quote}");
            Console.WriteLine();
        }
Ejemplo n.º 3
0
        public void Run()
        {
            string          content       = string.Empty;
            string          kanyeQuoteUrl = @"https://api.kanye.rest/";
            KanyeQuoteModel kanyeQuote    = new KanyeQuoteModel();

            try
            {
                using (var wc = GetWebClient())
                {
                    content = wc.DownloadString(kanyeQuoteUrl);
                }
                kanyeQuote = kanyeQuote = JsonSerializer.Deserialize <KanyeQuoteModel>(content);
            }
            catch
            {
                Console.WriteLine("Got no result or couldn't convert to an insightful Yeezy meme");
            }
            Console.WriteLine($"\n{kanyeQuote?.Quote}");
            Console.WriteLine();
        }