public void TestExecute()
        {
            SpreadsheetCompiler converter = new SpreadsheetCompiler();
            System.IO.Stream stream = Assembly.GetAssembly(this.GetType()).GetManifestResourceStream("org.drools.dotnet.examples.resources.data.IntegrationExampleTest.xls");
            System.String drl = converter.Compile(stream, InputType.XLS);
            Assert.IsNotNull(drl);
            //COMPILE
            PackageBuilder builder = new PackageBuilder();
            builder.AddPackageFromDrl(drl);

            Package pkg = builder.GetPackage();
            Assert.IsNotNull(pkg);
            System.Console.Out.WriteLine(pkg.GetErrorSummary());
            Assert.AreEqual(0, builder.GetErrors().Length);

            RuleBase rb = RuleBaseFactory.NewRuleBase();
            rb.AddPackage(pkg);

            WorkingMemory wm = rb.NewWorkingMemory();

            //ASSERT AND FIRE
            wm.assertObject(new Cheese("stilton", 42));
            wm.assertObject(new Person("michael", "stilton", 42));
            System.Collections.IList list = new System.Collections.ArrayList();
            wm.setGlobal("list", list);
            wm.fireAllRules();
            Assert.AreEqual(1, list.Count);
        }
 public void TestLoadCsv()
 {
     SpreadsheetCompiler converter = new SpreadsheetCompiler();
     System.IO.Stream stream = Assembly.GetAssembly(this.GetType()).GetManifestResourceStream("org.drools.dotnet.examples.resources.data.ComplexWorkbook.csv");
     System.String drl = converter.Compile(stream, InputType.CSV);
     Assert.IsNotNull(drl);
     Assert.IsTrue(drl.IndexOf("myObject.setIsValid(1, 2)") > 0);
     Assert.IsTrue(drl.IndexOf("myObject.size () > 50") > 0);
     //System.out.println(drl);
 }
        public void TestLoadFromClassPath()
        {
            SpreadsheetCompiler converter = new SpreadsheetCompiler();

            System.String drl = converter.Compile(new System.IO.FileStream(System.Environment.CurrentDirectory + "\\resources\\data\\MultiSheetDST.xls", System.IO.FileMode.Open), InputType.XLS);
            Assert.IsNotNull(drl);

            Assert.IsTrue(drl.IndexOf("rule \"How cool am I_12\"") > drl.IndexOf("rule \"How cool am I_11\""));
            Assert.IsTrue(drl.IndexOf("import example.model.User;") > - 1);
            Assert.IsTrue(drl.IndexOf("import example.model.Car;") > - 1);
        }
        public void TestLoadBasic()
        {
            SpreadsheetCompiler converter = new SpreadsheetCompiler();
            System.IO.Stream stream = Assembly.GetAssembly(this.GetType()).GetManifestResourceStream("org.drools.dotnet.examples.resources.data.BasicWorkbook.xls");
            System.String drl = converter.Compile(stream, InputType.XLS);

            Assert.IsNotNull(drl);
            Assert.IsTrue(drl.IndexOf("This is a function block") > - 1);
            Assert.IsTrue(drl.IndexOf("global Class1 obj1;") > - 1);
            //System.out.println(drl);
        }
 public void TestLoadSpecificWorksheet()
 {
     SpreadsheetCompiler converter = new SpreadsheetCompiler();
     System.IO.Stream stream = Assembly.GetAssembly(this.GetType()).GetManifestResourceStream("org.drools.dotnet.examples.resources.data.MultiSheetDST.xls");
     System.String drl = converter.Compile(stream, "Another Sheet");
     Assert.IsNotNull(drl);
 }