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.");
        }
Exemple #2
0
        /// <summary>
        /// Creates the fact set from an object instance.
        /// </summary>
        /// <param name="objectinstance">The object instance.</param>
        /// <param name="objectMapTable">The object map table.</param>
        /// <returns></returns>
        public List <WME> CreateFactSetFromObjectInstance(ObjectInstance objectinstance, ObjectMapTable objectMapTable)
        {
            ObjectInterface objectinterface = new ObjectInterface(AgendaName);
            Object          obj             = objectinstance.Object;

            return(objectinterface.createFactSetFromObjectInstance(obj, objectMapTable));
        }