Esempio n. 1
0
        public void CanFetchAndExecuteFilter()
        {
            string source = @"F:\vs10dev\ApprovaFlowSimpleWorkflowProcessor\Plugins\bin\Debug\Plugins.dll";

            var filterRegistry = new FilterRegistry<Step>();
            filterRegistry.LoadPlugIn(source);

            var filters = filterRegistry.GetFilters("Plugins.CaptainUnfitForCommandFilter")
                                        .ToList();

            Assert.AreEqual(1, filters.Count);

            var parameters = new Dictionary<string, object>();
            parameters.Add("KirkInfected", true);

            var step = new Step("12w", "231a", "CaptainApproval", "FirstOfficeReview",
                                "Deny", DateTime.Now, "Kirk", "Kirk",
                                parameters);
            step.CanProcess = true;

            step = filters[0].Execute(step);

            Assert.AreEqual(false, step.CanProcess);
            Assert.AreEqual(1, step.ErrorList.Count);
            Assert.IsTrue((bool)step.Parameters["MedicalOverride"]);
            Console.WriteLine(step.ErrorList[0]);
        }
Esempio n. 2
0
        public void CanRegisterPlugins()
        {
            string source = @"F:\vs10dev\ApprovaFlowSimpleWorkflowProcessor\Plugins\bin\Debug\Plugins.dll";

            var filterRegistry = new FilterRegistry<Step>();
            filterRegistry.LoadPlugIn(source);

            //  We should have 4 standard filters and one from the plugin
            Assert.AreEqual(5, filterRegistry.GetFilterCount());
            Console.WriteLine(filterRegistry.GetFilterNames());
        }