public void ObjectMapTest()
        {
            //String[] items = {"camera", "film"};
            //String[] discounts = {"nodiscount", "nodiscount"};

            //PurchaseOrder po = new PurchaseOrder(items, discounts);
            //PurchaseOrder po1 = new PurchaseOrder(items, discounts);
            CustomerTestClass cust = new CustomerTestClass();
            CustomerTestClass cust2 = new CustomerTestClass();
            LocationTestClass theLoc = new LocationTestClass("1", "root location");

            cust.IntVal = 4;
            cust.TheLocation.Description = "first location";
            cust2.TheLocation.Description = "second location";
            cust2.TheLocation.ID = "3";

            Stream mapStream = this.GetType().Assembly.GetManifestResourceStream("Expergent.Tester.ObjectMap.xml");
            StreamReader mapReader = new StreamReader(mapStream);

            ObjectMapTable theTable = new ObjectMapTable(mapReader);

            Agenda agenda = new Agenda();
            List<WME> facts = new List<WME>();
            facts.AddRange(agenda.CreateFactSetFromObjectInstance(new ObjectInstance("CustomerTestClass", cust), theTable));
            facts.AddRange(agenda.CreateFactSetFromObjectInstance(new ObjectInstance("CustomerTestClass", cust2), theTable));
            facts.AddRange(agenda.CreateFactSetFromObjectInstance(new ObjectInstance("LocationTestClass", theLoc), theTable));
            facts.AddRange(agenda.CreateFactSetFromObjectInstance(new ObjectInstance("MyClass", this), theTable));

            Assert.IsTrue(facts.Count == 31, "Wrong # of facts.");
        }
        public void ObjectGraphTest()
        {
            String[] items = { "camera", "film" };
            String[] discounts = { "nodiscount", "nodiscount" };

            PurchaseOrder po = new PurchaseOrder(items, discounts);
            PurchaseOrder po1 = new PurchaseOrder(items, discounts);
            CustomerTestClass cust = new CustomerTestClass();
            CustomerTestClass cust2 = new CustomerTestClass();
            LocationTestClass theLoc = new LocationTestClass("1", "root location");

            cust.IntVal = 4;
            cust.TheLocation.Description = "first location";
            cust2.TheLocation.Description = "second location";
            cust2.TheLocation.ID = "3";

            Agenda agenda = new Agenda();
            List<WME> facts = new List<WME>();
            facts.AddRange(agenda.CreateFactSetFromObjectInstanceWithObjectGrapher(new ObjectInstance("PurchaseOrder", po)));
            facts.AddRange(agenda.CreateFactSetFromObjectInstanceWithObjectGrapher(new ObjectInstance("PurchaseOrder", po1)));
            facts.AddRange(agenda.CreateFactSetFromObjectInstanceWithObjectGrapher(new ObjectInstance("CustomerTestClass", cust)));
            facts.AddRange(agenda.CreateFactSetFromObjectInstanceWithObjectGrapher(new ObjectInstance("CustomerTestClass", cust2)));
            facts.AddRange(agenda.CreateFactSetFromObjectInstanceWithObjectGrapher(new ObjectInstance("LocationTestClass", theLoc)));
            facts.AddRange(agenda.CreateFactSetFromObjectInstanceWithObjectGrapher(new ObjectInstance("MyClass", this)));

            Assert.IsTrue(facts.Count == 1770, "Wrong # of facts.");
        }
Example #3
0
        public ChildHash2()
        {
            LocationTestClass theLoc = new LocationTestClass("1", "location 1");
            this.Add(theLoc.ID, theLoc);

            theLoc = new LocationTestClass("2", "location 2");
            this.Add(theLoc.ID, theLoc);

            theLoc = new LocationTestClass("3", "location 3");
            this.Add(theLoc.ID, theLoc);
        }
        public ChildNOCollection2()
        {
            LocationTestClass theLoc = new LocationTestClass("1", "location 1");
            this.BaseAdd(theLoc.ID, theLoc);

            theLoc = new LocationTestClass("2", "location 2");
            this.BaseAdd(theLoc.ID, theLoc);

            theLoc = new LocationTestClass("3", "location 3");
            this.BaseAdd(theLoc.ID, theLoc);
        }
Example #5
0
        public ChildHash2()
        {
            LocationTestClass theLoc = new LocationTestClass("1", "location 1");

            this.Add(theLoc.ID, theLoc);

            theLoc = new LocationTestClass("2", "location 2");
            this.Add(theLoc.ID, theLoc);

            theLoc = new LocationTestClass("3", "location 3");
            this.Add(theLoc.ID, theLoc);
        }
Example #6
0
        public ChildNOCollection2()
        {
            LocationTestClass theLoc = new LocationTestClass("1", "location 1");

            this.BaseAdd(theLoc.ID, theLoc);

            theLoc = new LocationTestClass("2", "location 2");
            this.BaseAdd(theLoc.ID, theLoc);

            theLoc = new LocationTestClass("3", "location 3");
            this.BaseAdd(theLoc.ID, theLoc);
        }
        public CustomerTestClass()
        {
            _child.NextChild = new ChildObjectTest();
            /*
            _theLocs.Add(new LocationTestClass("", "location 1"));
            _theLocs.Add(new LocationTestClass("2", "location 2"));
            _theLocs.Add(new LocationTestClass("3", "location 3"));
            _theLocs.Add(new LocationTestClass("4", "location 4"));
            */
            _stringList.Add("first val");
            _stringList.Add("second val");
            _stringList.Add("third val");
            _theFirstNested.Add(new FirstOrderCollection());
            _theFirstNested.Add(new FirstOrderCollection());

            _myLoc = new LocationTestClass("2", "location1");
        }
Example #8
0
        public CustomerTestClass()
        {
            _child.NextChild = new ChildObjectTest();

/*
 *                      _theLocs.Add(new LocationTestClass("", "location 1"));
 *                      _theLocs.Add(new LocationTestClass("2", "location 2"));
 *                      _theLocs.Add(new LocationTestClass("3", "location 3"));
 *                      _theLocs.Add(new LocationTestClass("4", "location 4"));
 */
            _stringList.Add("first val");
            _stringList.Add("second val");
            _stringList.Add("third val");
            _theFirstNested.Add(new FirstOrderCollection());
            _theFirstNested.Add(new FirstOrderCollection());

            _myLoc = new LocationTestClass("2", "location1");
        }