public void CanParseArrayOfStrings() { var strings = new List <string> { "hello there", "hola", "what do you have there?" }; Assert.Equal("there", ReactionParser.MostFrequentWord(strings)); }
public string GetAndUpdateMostCommonWord(int eventId) { //This contoller method demonstrates the NEW BEHAVIOR of DbContext.Entry.State //which will only affect the root of the graph passed in var eventGraph = _repo.GetWeatherEventAndReactionsById(eventId); var theWord = ReactionParser.MostFrequentWord( eventGraph.Reactions.Select(r => r.Quote).ToList()); eventGraph.MostCommonWord = theWord; _repo.UpdateWeatherEventOnly(eventGraph); Console.WriteLine($"NOTE: Graph still has {eventGraph.Reactions.Count} reactions attached"); return(theWord); }