コード例 #1
0
        public void TestCreateProcessDefinitionWithScriptAndRetrieve()
        {
            ProcessDefinition pd      = BuildProcessdefinition("id.123", "test_definition", "description");
            Md5CalcVisitor    visitor = new Md5CalcVisitor();

            pd.Accept(visitor);
            string md5 = visitor.CalculateMd5();
            IProcessDefinitionPersisnenceService service = InstService();

            service.Create(pd, ProcessDefStatusEnum.Active, 1);
            IReadOnlyList <ProcessDefinitionDigest> flows = service.LisAlltWorkflows();

            Assert.IsNotNull(flows);
            Assert.AreEqual(1, flows.Count);
            ProcessDefStatusEnum stat;
            ProcessDefinition    savedPd;

            AccountData[] accounts;
            Assert.IsTrue(service.TryFind(flows[0].Id, flows[0].Version, out savedPd, out stat, out accounts));

            Assert.IsNotNull(savedPd);
            visitor.Reset();
            savedPd.Accept(visitor);
            string savedMd5 = visitor.CalculateMd5();

            Assert.AreEqual(md5, savedMd5);
        }
コード例 #2
0
        protected virtual void OnTryFindFlow(IProcessDefinitionPersisnenceService service)
        {
            var processDefinition = BuildProcessdefinition();

            Assert.IsNotNull(processDefinition);
            service.Create(processDefinition, ProcessDefStatusEnum.Active, 1);
            ProcessDefinition    definition;
            ProcessDefStatusEnum stat;

            AccountData[] pdAccounts;
            Assert.IsTrue(service.TryFind(processDefinition.Id, 1, out definition, out stat, out pdAccounts));
            Assert.IsNotNull(definition);
            Md5CalcVisitor visitor = new Md5CalcVisitor();

            processDefinition.Accept(visitor);
            string md5 = visitor.CalculateMd5();

            visitor.Reset();
            definition.Accept(visitor);
            string restoredMd5 = visitor.CalculateMd5();

            Assert.AreEqual(md5, restoredMd5);
        }