Example #1
0
 public virtual void TestFindRoots(IThing described, IThing description, ILink descriptionLink)
 {
     foreach (IThing item in Graph.FindRoots(described))
     {
         Assert.IsFalse(item.Equals(descriptionLink), descriptionLink.ToString());
         Assert.IsFalse(item.Equals(description), description.ToString());
     }
 }
Example #2
0
 void ReportThing(IThing clThing)
 {
     if (clThing != null)
     {
         Debug.WriteLine(clThing.ToString());
     }
     else
     {
         Debug.WriteLine("Thing is null");
     }
 }
Example #3
0
        public virtual void TestIdentity(IThing thing)
        {
            bool identity = false;

            if (thing is ILink)
            {
                identity = Schema.IdentityGraph.Contains((ILink)thing);
            }
            else
            {
                identity = Schema.IdentityGraph.Contains(thing);
            }

            if (!identity)
            {
                this.ReportDetail(thing.ToString() + " is not contained in IdentityGraph");
            }
            Assert.IsTrue(identity);
        }
Example #4
0
        public void TestPureClient()
        {
            try {
                var clThing = ClientService.GetById(0);
                ReportThing(clThing);
            } catch (Exception e) {
                Debug.WriteLine(e.Message);
            }

            Debug.WriteLine("**** Markers of Service ****");
            try {
                foreach (var id in ClientService.Markers())
                {
                    var clThing = ClientService.GetById(id);
                    ReportThing(clThing);
                }
            } catch (Exception e) {
                Debug.WriteLine(e.Message);
            }

            Debug.WriteLine("**** all items of Service ****");
            try {
                foreach (var id in ClientService.AllItems())
                {
                    IThing clThing = ClientService.GetById(id);
                    if (clThing != null)
                    {
                        Debug.WriteLine(clThing.ToString());
                        foreach (ILink link in ClientService.Edges(clThing))
                        {
                            ReportThing(link);
                        }
                    }
                    else
                    {
                        Debug.WriteLine("ERROR: Thing is null");
                    }
                }
            } catch (Exception e) {
                Debug.WriteLine(e.Message);
            }
        }
Example #5
0
        public object ThingDataToDisplay(IGraph <IThing, ILink> graph, IThing thing)
        {
            if (thing == null)
            {
                return(CommonSchema.NullString);
            }

            thing = ThingToDisplay(graph, thing);
            object result = null;

            if (thing is IProxy)
            {
                result = CommonSchema.ProxyString;
            }
            else
            {
                result = thing.Data;
            }

            if (thing is ILink)
            {
                result = thing.ToString();
            }
            else if (thing.Id == CommonSchema.EmptyMarker.Id)
            {
                result = CommonSchema.EmtpyMarkerString;
            }
            else if (thing.GetType() == typeof(Thing))
            {
                result = CommonSchema.ThingString;
            }
            if (result == null)
            {
                return(CommonSchema.NullString);
            }
            return(result);
        }