public void DirectObjectsTest() { var target = new BaseVerb("slay"); IEnumerable <IEntity> actual = target.DirectObjects; Check.That(target.DirectObjects).IsEqualTo(actual); }
public void HasSubjectOrObjectTest() { var text = "attack"; Verb target = new BaseVerb(text); IEntity entity = new CommonPluralNoun("monkeys"); var rand = new Random().Next(-1, 2); switch (rand) { case -1: target.BindSubject(entity); break; case 0: target.BindDirectObject(entity); break; case 1: target.BindDirectObject(entity); break; default: Check.That(false).IsTrue(); break; } var expected = true; bool actual; actual = target.HasSubjectOrObject(predicate); Check.That(actual).Equals(expected); bool predicate(IEntity e) => e.Text == "monkeys"; }
public void ModifiesTest() { var quickly = new Adverb("quickly"); IAdverbialModifiable ran = new BaseVerb("ran"); quickly.Modifies = ran; Check.That(quickly.Modifies).IsEqualTo(ran); }
public void GetSynonymsOfVerbIsReflexive() { Verb walk = new BaseVerb("walk"); Verb perambulate = new BaseVerb("perambulate"); Check.That(walk.GetSynonyms()).Contains("perambulate"); Check.That(perambulate.GetSynonyms()).Contains("walk"); }
public void BindDirectObjectTest() { var target = new BaseVerb("slay"); IEntity directObject = new PersonalPronoun("them"); target.BindDirectObject(directObject); Check.That(target.DirectObjects).Contains(directObject); }
public void IsClassifierTest() { var text = "is"; Verb target = new BaseVerb(text); bool isClassifier; isClassifier = target.IsClassifier; Check.That(isClassifier).IsTrue(); }
public void TextTest() { Word target = new BaseVerb("run"); var expected = "run"; string actual; actual = target.Text; Check.That(actual).IsEqualTo(expected); }
public void DirectObjectOfTest() { var target = new NounPhrase(new ProperPluralNoun("Americans"), new Conjunction("and"), new ProperPluralNoun("Canadians")); IVerbal expected = new BaseVerb("insult"); target.BindAsDirectObjectOf(expected); var actual = target.DirectObjectOf; Check.That(actual).IsEqualTo(expected); }
public void BindSubjectTest() { var text = "gave"; Verb target = new BaseVerb(text); IEntity subject = new PersonalPronoun("he"); target.BindSubject(subject); Check.That(target.Subjects).Contains(subject).And.HasSize(1); }
public void ModifyWithTest() { var text = "insulate"; Verb target = new BaseVerb(text); IAdverbial adv = new Adverb("sufficiently"); target.ModifyWith(adv); Check.That(target.AdverbialModifiers).Contains(adv).And.HasSize(1); }
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 SelectManyTest1() { var expectedWord = new BaseVerb("walk"); ILexical target = new Clause(new VerbPhrase(expectedWord, new Adverb("briskly"))); var result = from phrase in target.Match() .Case((Clause c) => c.Phrases.OfVerbPhrase().First()) from word in phrase.Words select word; Assert.Equal(expectedWord, result.First()); }
public void ModifiesTest() { var text = "can"; var target = new ModalAuxilary(text); IModalityModifiable expected = new BaseVerb("do"); IModalityModifiable actual; target.Modifies = expected; actual = target.Modifies; Check.That(actual).IsEqualTo(expected); }
public void AttachObjectViaPrepositionTest() { var text = "insulate"; Verb target = new BaseVerb(text); var prepositionObject = new NounPhrase(new PersonalPronoun("them")); IPrepositional prep = new Preposition("for"); prep.BindObject(prepositionObject); target.AttachObjectViaPreposition(prep); Check.That(target.ObjectOfThePreposition).Equals(prepositionObject); }
public void ModalityTest() { var text = "insulate"; Verb target = new BaseVerb(text); var expected = new ModalAuxilary("can"); ModalAuxilary actual; target.Modality = expected; actual = target.Modality; Check.That(actual).Equals(expected); }
public void VerbConstructorTest() { var text = "insulate"; Verb target = new BaseVerb(text); Check.That(target.Text).Equals(text); Check.That(target.Subjects).IsEmpty(); Check.That(target.DirectObjects).IsEmpty(); Check.That(target.IndirectObjects).IsEmpty(); Check.That(target.Modality).IsNull(); Check.That(target.IsPossessive).IsFalse(); }
public void SelectManyTest7() { var word = new BaseVerb("walk"); var verbPhrase = new VerbPhrase(word, new Adverb("briskly")); var expected = new { Character = 'w', Word = word, Phrase = verbPhrase }; ILexical target = new Clause(verbPhrase); var result = from phrase in target.Match() .Case((Clause c) => c.Phrases.OfVerbPhrase().First()) from w in phrase.Words.OfVerb() select new { Character = w.Text.First(), word = w, Phrase = phrase }; Assert.Equal(expected.Phrase, result.First().Phrase); }
public void SubjectOfTest() { var target = new AggregateEntity( new NounPhrase(new CommonPluralNoun("cats")), new NounPhrase(new CommonPluralNoun("dogs")) ); IVerbal expected = new BaseVerb("eat"); IVerbal actual; target.BindAsSubjectOf(expected); actual = target.SubjectOf; Check.That(actual).IsEqualTo(expected); }
public void IsRelatedToOnTest2() { IEntity performer = new CommonPluralNoun("dogs"); IEntity receiver = new CommonPluralNoun("cats"); IVerbal relator = new BaseVerb("chase"); relator.BindSubject(performer); relator.BindDirectObject(receiver); performer.SetRelationshipLookup(new RelationshipLookup <IEntity, IVerbal>(new[] { relator }, Equals, Equals, Equals)); var actual = RelationshipInferenceExtensions.IsRelatedTo(receiver, performer).On(relator); Check.That(actual).IsTrue(); }
public void AggregateDirectObjectTest() { var text = "attack"; Verb target = new BaseVerb(text); IAggregateEntity actual; actual = target.AggregateDirectObject; Check.That(actual).IsEmpty(); IEntity directObject = new CommonPluralNoun("monkeys"); target.BindDirectObject(directObject); actual = target.AggregateDirectObject; Check.That(new[] { directObject }.Except(actual)).IsEmpty(); }
public void AggregateDirectObjectTest() { var target = new BaseVerb("slay"); IAggregateEntity aggregateObject = new AggregateEntity( new NounPhrase(new ProperSingularNoun("John"), new ProperSingularNoun("Smith")), new NounPhrase(new PossessivePronoun("his"), new CommonPluralNoun("cats")) ); target.BindDirectObject(aggregateObject); var actual = target.AggregateDirectObject; Check.That(actual).ContainsExactly(aggregateObject).And.Not.IsNull().And.Not.IsEmpty(); }
public void SubjectsTest() { var text = "attack"; Verb target = new BaseVerb(text); IEnumerable <IEntity> actual; actual = target.Subjects; Check.That(actual).IsEmpty(); IEntity subject = new CommonPluralNoun("chimpanzees"); target.BindSubject(subject); actual = target.Subjects; Check.That(actual).Contains(subject); Check.That(target.AggregateSubject).Contains(subject); }
public void DirectObjectsTest() { var text = "attack"; Verb target = new BaseVerb(text); IEnumerable <IEntity> actual; actual = target.IndirectObjects; Check.That(actual).IsEmpty(); IEntity directObject = new CommonPluralNoun("monkeys"); target.BindDirectObject(directObject); actual = target.DirectObjects; Check.That(actual).Contains(directObject); Check.That(target.AggregateDirectObject).Contains(directObject); }
public void IsRelatedToTest() { IEntity performer = new CommonPluralNoun("dogs"); IEntity receiver = new CommonPluralNoun("cats"); IVerbal relator = new BaseVerb("chase"); relator.BindSubject(performer); relator.BindDirectObject(receiver); performer.SetRelationshipLookup(new RelationshipLookup <IEntity, IVerbal>(new[] { relator }, Equals, Equals, Equals)); ActionsRelatedOn?expected = new ActionsRelatedOn(new[] { relator }); ActionsRelatedOn?actual; actual = RelationshipInferenceExtensions.IsRelatedTo(performer, receiver); Check.That(actual).IsEqualTo(expected); }
internal virtual IModalityModifiable CreateIModalityModifiable() { IModalityModifiable target = new BaseVerb("laugh"); return(target); }
internal virtual IInderectObjectTaker CreateIInderectObjectTaker() { IInderectObjectTaker target = new BaseVerb("walk"); return(target); }
public void GetSynonymsOfVerbIncludesOwnText() { Verb heal = new BaseVerb("heal"); Check.That(heal.GetSynonyms().Contains(heal.Text, StringComparer.OrdinalIgnoreCase)).IsTrue(); }