Пример #1
0
        public void SetRelationshipLookupTest1()
        {
            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);

            // Without calling RelationShipInferenceExtensions.SetRelationshipLookup(entity1, relationshipLookup) beforehand
            Check.ThatCode(() => entity1.IsRelatedTo(entity2)).Throws <InvalidOperationException>();
        }
Пример #2
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);
        }