Exemplo n.º 1
0
        public void Insert()
        {
            //Setup
            Performer performer = new Performer
            {
                FirstName = "SLTEST",
                LastName  = "SLTEST"
            };
            PerformerList performers = new PerformerList();

            performers.Load();
            int originalCount = performers.Count();



            //Act
            HttpClient client = InitializeClient();
            //Serialize a performer object that we're trying to insert
            string serializedPerformer = JsonConvert.SerializeObject(performer);
            var    content             = new StringContent(serializedPerformer);

            content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
            HttpResponseMessage response = client.PostAsync("Performer", content).Result;

            //Assert
            performers.Clear();
            performers.Load();
            Assert.AreEqual(originalCount + 1, performers.Count);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 一个流程的完整测试(开始 -> 运行 -> 撤销 -> 运行 -> 退回 -> 运行 -> 结束 -> 返签 -> 运行 -> 结束)
        /// </summary>
        /// <param name="initiator"></param>
        /// <returns></returns>
        public WfExecutedResult StartupRunningEnd(WfAppRunner initiator)
        {
            //流程开始->业务员提交
            StartProcess(initiator);

            //业务员提交->板房签字
            var           banFangNodeGuid = "fc8c71c5-8786-450e-af27-9f6a9de8560f";
            PerformerList pList           = new PerformerList();

            pList.Add(new Performer(20, "Zhang"));

            initiator.NextActivityPerformers = new Dictionary <Guid, PerformerList>();
            initiator.NextActivityPerformers.Add(Guid.Parse(banFangNodeGuid), pList);
            RunProcessApp(initiator);

            //板房签字->业务员签字
            //登录用户身份
            initiator.UserID   = 20;
            initiator.UserName = "******";

            var salesGuid = "39c71004-d822-4c15-9ff2-94ca1068d745";

            pList.Clear();
            pList.Add(new Performer(10, "Long"));

            initiator.NextActivityPerformers.Clear();
            initiator.NextActivityPerformers.Add(Guid.Parse(salesGuid), pList);
            RunProcessApp(initiator);

            //业务员签字->结束
            //登录用户身份
            initiator.UserID   = 10;
            initiator.UserName = "******";

            var endGuid = "b70e717a-08da-419f-b2eb-7a3d71f054de";

            pList.Clear();
            pList.Add(new Performer(10, "Long"));

            initiator.NextActivityPerformers.Clear();
            initiator.NextActivityPerformers.Add(Guid.Parse(endGuid), pList);
            RunProcessApp(initiator);

            return(_wfExecutedResult);
        }
Exemplo n.º 3
0
        public async Task GetPerformers()
        {
            var performerList = await _performerService.Get <IEnumerable <Performer> >(null, "GetPerformers");

            PerformerList.Clear();
            foreach (var item in performerList)
            {
                PerformerList.Add(item);
            }
        }
Exemplo n.º 4
0
        public void Delete()
        {
            //Setup
            PerformerList performers = new PerformerList();

            performers.Load();
            int       originalCount = performers.Count();
            Performer performer     = performers.FirstOrDefault(c => c.FirstName == "SLTEST1");


            //Act
            if (performer != null)
            {
                HttpClient          client   = InitializeClient();
                HttpResponseMessage response = client.DeleteAsync("Performer/" + performer.Id).Result;
            }

            //Assert
            performers.Clear();
            performers.Load();
            Assert.AreEqual(originalCount - 1, performers.Count);
        }
Exemplo n.º 5
0
        public void StartupRunEnd()
        {
            IDbConnection conn = new SqlConnection(DBConfig.ConnectionString);

            conn.Open();


            ////StarterA:
            ////{"UserID":"10","UserName":"******","AppName":"SamplePrice","AppInstanceID":"100","ProcessGUID":"072af8c3-482a-4b1c-890b-685ce2fcc75d"}
            var initiator = new WfAppRunner();

            initiator.AppName       = "SamplePrice";
            initiator.AppInstanceID = 100;
            initiator.ProcessGUID   = Guid.Parse("072af8c3-482a-4b1c-890b-685ce2fcc75d");
            initiator.UserID        = 10;
            initiator.UserName      = "******";

            IWorkflowService service = new WorkflowService();

            //流程开始->业务员提交
            IDbTransaction trans = conn.BeginTransaction();

            try
            {
                service.StartProcess(conn, initiator, trans);
                trans.Commit();
            }
            catch
            {
                trans.Rollback();
                throw;
            }
            finally
            {
                trans.Dispose();
            }

            //业务员提交->板房签字
            var           banFangNodeGuid = "fc8c71c5-8786-450e-af27-9f6a9de8560f";
            PerformerList pList           = new PerformerList();

            pList.Add(new Performer(20, "Zhang"));

            initiator.NextActivityPerformers = new Dictionary <Guid, PerformerList>();
            initiator.NextActivityPerformers.Add(Guid.Parse(banFangNodeGuid), pList);

            trans = conn.BeginTransaction();
            try
            {
                service.RunProcessApp(conn, initiator, trans);
                trans.Commit();
            }
            catch
            {
                trans.Rollback();
                throw;
            }
            finally
            {
                trans.Dispose();
            }

            //板房签字->业务员签字
            //登录用户身份
            initiator.UserID   = 20;
            initiator.UserName = "******";

            var salesGuid = "39c71004-d822-4c15-9ff2-94ca1068d745";

            pList.Clear();
            pList.Add(new Performer(10, "Long"));

            initiator.NextActivityPerformers.Clear();
            initiator.NextActivityPerformers.Add(Guid.Parse(salesGuid), pList);
            trans = conn.BeginTransaction();
            try
            {
                service.RunProcessApp(conn, initiator, trans);
                trans.Commit();
            }
            catch
            {
                trans.Rollback();
                throw;
            }
            finally
            {
                trans.Dispose();
            }

            //业务员签字->结束
            //登录用户身份
            initiator.UserID   = 10;
            initiator.UserName = "******";

            var endGuid = "b70e717a-08da-419f-b2eb-7a3d71f054de";

            pList.Clear();
            pList.Add(new Performer(10, "Long"));

            initiator.NextActivityPerformers.Clear();
            initiator.NextActivityPerformers.Add(Guid.Parse(endGuid), pList);
            trans = conn.BeginTransaction();
            try
            {
                service.RunProcessApp(conn, initiator, trans);
                trans.Commit();
            }
            catch
            {
                trans.Rollback();
                throw;
            }
            finally
            {
                trans.Dispose();
            }

            if (conn.State == ConnectionState.Open)
            {
                conn.Close();
            }
        }
Exemplo n.º 6
0
        public void StartupRunEnd()
        {
            IDbConnection conn = new SqlConnection(DBConfig.ConnectionString);
            conn.Open();

            ////StarterA:
            ////{"UserID":"10","UserName":"******","AppName":"SamplePrice","AppInstanceID":"100","ProcessGUID":"072af8c3-482a-4b1c-890b-685ce2fcc75d"}
            var initiator = new WfAppRunner();
            initiator.AppName = "SamplePrice";
            initiator.AppInstanceID = 100;
            initiator.ProcessGUID = Guid.Parse("072af8c3-482a-4b1c-890b-685ce2fcc75d");
            initiator.UserID = 10;
            initiator.UserName = "******";

            IWorkflowService service = new WorkflowService();

            //流程开始->业务员提交
            IDbTransaction trans = conn.BeginTransaction();
            try
            {
                service.StartProcess(conn, initiator, trans);
                trans.Commit();
            }
            catch
            {
                trans.Rollback();
                throw;
            }
            finally
            {
                trans.Dispose();
            }

            //业务员提交->板房签字
            var banFangNodeGuid = "fc8c71c5-8786-450e-af27-9f6a9de8560f";
            PerformerList pList = new PerformerList();
            pList.Add(new Performer(20, "Zhang"));

            initiator.NextActivityPerformers = new Dictionary<Guid, PerformerList>();
            initiator.NextActivityPerformers.Add(Guid.Parse(banFangNodeGuid), pList);

            trans = conn.BeginTransaction();
            try
            {
                service.RunProcessApp(conn, initiator, trans);
                trans.Commit();
            }
            catch
            {
                trans.Rollback();
                throw;
            }
            finally
            {
                trans.Dispose();
            }

            //板房签字->业务员签字
            //登录用户身份
            initiator.UserID = 20;
            initiator.UserName = "******";

            var salesGuid = "39c71004-d822-4c15-9ff2-94ca1068d745";
            pList.Clear();
            pList.Add(new Performer(10, "Long"));

            initiator.NextActivityPerformers.Clear();
            initiator.NextActivityPerformers.Add(Guid.Parse(salesGuid), pList);
            trans = conn.BeginTransaction();
            try
            {
                service.RunProcessApp(conn, initiator, trans);
                trans.Commit();
            }
            catch
            {
                trans.Rollback();
                throw;
            }
            finally
            {
                trans.Dispose();
            }

            //业务员签字->结束
            //登录用户身份
            initiator.UserID = 10;
            initiator.UserName = "******";

            var endGuid = "b70e717a-08da-419f-b2eb-7a3d71f054de";
            pList.Clear();
            pList.Add(new Performer(10, "Long"));

            initiator.NextActivityPerformers.Clear();
            initiator.NextActivityPerformers.Add(Guid.Parse(endGuid), pList);
            trans = conn.BeginTransaction();
            try
            {
                service.RunProcessApp(conn, initiator, trans);
                trans.Commit();
            }
            catch
            {
                trans.Rollback();
                throw;
            }
            finally
            {
                trans.Dispose();
            }

            if (conn.State == ConnectionState.Open)
                conn.Close();
        }