public void WhereTest1() { ILexical target = new VerbPhrase(new BaseVerb("walk"), new Adverb("briskly")); var result = from word in target.Match() .Case((VerbPhrase v) => v.Words.OfVerb().First()) where word.Text == "run" // false select word; Check.That(result).IsEmpty(); }
public void SelectTest1() { var expectedWord = new BaseVerb("walk"); ILexical target = new VerbPhrase(expectedWord, new Adverb("briskly")); var result = from word in target.Match() .Case((VerbPhrase v) => v.Words.OfVerb().First()) select word; Assert.Equal(expectedWord, result.Single()); }
public void MatchChangingMidwayToLessDerivedResultType1() { ILexical target = new VerbPhrase(new BaseVerb("walk"), new Adverb("briskly")); var result = target.Match() .Case((VerbPhrase v) => v.Words) .Case((IVerbal v) => new[] { v }.OfType <ILexical>()) .Result(); Check.That(result).IsNotNull().And.Contains(((Phrase)target).Words).Only().InThatOrder(); }