Exemple #1
0
        public void  TestHonestPolitician()
        {
            System.IO.Stream stream  = Assembly.GetAssembly(this.GetType()).GetManifestResourceStream("org.drools.dotnet.examples.rules.HonestPolitician.drl");
            PackageBuilder   builder = new PackageBuilder();

            builder.AddPackageFromDrl(stream);
            Package  pkg      = builder.GetPackage();
            RuleBase ruleBase = RuleBaseFactory.NewRuleBase();

            ruleBase.AddPackage(pkg);
            WorkingMemory workingMemory = ruleBase.NewWorkingMemory();



            Politician blair    = new Politician("blair", true);
            Politician bush     = new Politician("bush", true);
            Politician chirac   = new Politician("chirac", true);
            Politician schroder = new Politician("schroder", true);

            workingMemory.assertObject(blair);
            workingMemory.assertObject(bush);
            workingMemory.assertObject(chirac);
            workingMemory.assertObject(schroder);

            workingMemory.fireAllRules();
        }
        public void TestHonestPolitician()
        {
            System.IO.Stream stream = Assembly.GetAssembly(this.GetType()).GetManifestResourceStream("org.drools.dotnet.examples.rules.HonestPolitician.drl");
            PackageBuilder builder = new PackageBuilder();
            builder.AddPackageFromDrl(stream);
            Package pkg = builder.GetPackage();
            RuleBase ruleBase = RuleBaseFactory.NewRuleBase();
            ruleBase.AddPackage(pkg);
            WorkingMemory workingMemory = ruleBase.NewWorkingMemory();

            Politician blair = new Politician("blair", true);
            Politician bush = new Politician("bush", true);
            Politician chirac = new Politician("chirac", true);
            Politician schroder = new Politician("schroder", true);

            workingMemory.assertObject(blair);
            workingMemory.assertObject(bush);
            workingMemory.assertObject(chirac);
            workingMemory.assertObject(schroder);

            workingMemory.fireAllRules();
        }