public void CallRssWebMethodTest() { RSSReader reader = new RSSReader(); reader.GetLastTenPosts(); Assert.AreNotEqual(0, reader.GetLastTenPosts().Count); }
static void Main(string[] args) { try { Console.WriteLine("Bem vindo."); Console.WriteLine("Realizando a primeira etapa do teste."); Console.WriteLine("lendo os 10 últimos posts do blog: https://www.minutoseguros.com.br/blog/feed/"); var reader = new RSSReader(); Console.WriteLine("..........."); var itens = reader.GetLastTenPosts(); Console.WriteLine($"Encontrado {itens.Count} novos posts no blog."); Console.WriteLine("Realizando a segunda etapa do teste, 'O seu programa deverá avaliar quais as dez principais palavras abordadas nesses tópicos.'"); Console.WriteLine("..........."); var words = reader.GetTopTenWordsInRssTopic(itens); Console.WriteLine("As palavras mais encontradas foram:"); foreach (var item in words) { Console.WriteLine($"{item.Word} encontrada {item.Quantity} vezes"); } Console.WriteLine("Desafio finalizado."); Console.ReadLine(); } catch (Exception) { Console.WriteLine("Houve um erro na execução do desafio."); } }
public void GetTopTenWordsInRssTopicTest() { RSSReader reader = new RSSReader(); var posts = reader.GetLastTenPosts(); var mostTopics = reader.GetTopTenWordsInRssTopic(posts); Assert.AreNotEqual(0, mostTopics.Count); }
public void RemoveHtmlAttributesTest() { RSSReader reader = new RSSReader(); var posts = reader.GetLastTenPosts(); foreach (var item in posts) { if (item.Title.Contains("<") || item.Title.Contains("/>")) { Assert.Fail("The html was not removed from Title."); } if (item.Description.Contains("<") || item.Description.Contains("/>")) { Assert.Fail("The html was not removed from Description."); } if (item.Content.Contains("<") || item.Content.Contains("/>")) { Assert.Fail("The html was not removed from Description."); } } }