public void TryParse() { FoosMatch match; Assert.IsTrue(MatchParser.TryParse("@playerA @playerB 1-10", out match)); Assert.AreEqual("@playerB", match.Winner.Id); Assert.AreEqual("@playerA", match.Looser.Id); Assert.AreEqual(10, match.GoalsWinner); Assert.AreEqual(1, match.GoalsLooser); }
public static IEnumerable <FoosMatch> GetMatches(IEnumerable <Message> messages) { FoosMatch match = null; return(messages.Where(m => MatchParser.TryParse(m.Text, out match)).Select(m => match)); }