Beispiel #1
0
        public void OnTest1()
        {
            ActionsRelatedOn?relatorSet = null;
            IVerbal          relator    = new PastTenseVerb("walked");
            var actual = RelationshipInferenceExtensions.On(relatorSet, relator);

            Check.That(actual).IsFalse();
        }
Beispiel #2
0
        public void OnTest2()
        {
            IVerbal          relator    = new PastTenseVerb("walked");
            ActionsRelatedOn?relatorSet = new ActionsRelatedOn(new[] { relator });
            var actual = RelationshipInferenceExtensions.On(relatorSet, relator);

            Check.That(actual).IsTrue();
        }
Beispiel #3
0
        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();
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        public void SetRelationshipLookupTest4()
        {
            IEntity entity1 = new ProperSingularNoun("John");
            IVerbal verb    = new PastTenseVerb("walked");
            IEntity entity2 = new NounPhrase(new Determiner("the"), new CommonSingularNoun("store"));

            verb.BindSubject(entity1);
            verb.BindDirectObject(entity2); IEnumerable <IVerbal> domain = new[] { verb };
            IRelationshipLookup <IEntity, IVerbal> relationshipLookup    = CreateRelationshipLookup(domain);

            RelationshipInferenceExtensions.SetRelationshipLookup(entity1, relationshipLookup);
            ActionsRelatedOn?actual;

            actual = entity1.IsRelatedTo(new NounPhrase(new Determiner("the"), new CommonSingularNoun("store")));
            Check.That(actual).IsNull();// After calling RelationShipInferenceExtensions.SetRelationshipLookup(entity1, relationshipLookup);
        }