Esempio n. 1
0
        public void FilterAndMergeNotMatchedActivityMatrixAndApprovalMatrixTest()
        {
            SOARolePropertiesQueryParam queryParam = new SOARolePropertiesQueryParam();

            queryParam.QueryName  = "CostCenter";
            queryParam.QueryValue = "1001";

            WfActivityMatrixResourceDescriptor resource = ActivityMatrixHelper.PrepareActivityMatrixResourceDescriptor();

            resource.Rows.ForEach(row => row.Values.FindByColumnName(SOARolePropertyDefinition.ActivityCodeColumn).Value = "NotMatched");

            SOARolePropertyRowCollection activityRows = resource.Rows.Query(queryParam);

            int originalActivityCount = activityRows.Count;

            WfApprovalMatrix approvalMatrix = ApprovalMatrixHelper.PrepareApprovalMatrix();

            SOARolePropertyRowCollection approvalRows = approvalMatrix.Rows.Query(queryParam);

            int originalApprovalCount = approvalMatrix.PropertyDefinitions.Count - 1;

            activityRows.MergeApprovalMatrix(resource.PropertyDefinitions, approvalRows, approvalMatrix.PropertyDefinitions);

            activityRows.AssertAndOutputMatrixOperators();

            Assert.AreEqual(originalActivityCount + originalApprovalCount, activityRows.Count);
        }
Esempio n. 2
0
		protected void MatrixTest(object sender, EventArgs e)
		{
			SOARolePropertiesQueryParam qp = new SOARolePropertiesQueryParam();
			qp.QueryName = "AdminUnit";
			qp.QueryValue = "";
			OguDataCollection<IUser> users = GetUsersFromSOARole(new SOARolePropertiesQueryParamCollection() { qp });
			users.ForEach(p =>
			{
				Response.Output.WriteLine("<br/>" + p.LogOnName);
			});
		}
Esempio n. 3
0
        public void QueryRoleSingleProperty()
        {
            SOARole role = PrepareSOARole();

            SOARolePropertiesQueryParam queryParam = new SOARolePropertiesQueryParam();

            queryParam.QueryName  = "CostCenter";
            queryParam.QueryValue = "1001";

            SOARolePropertyRowCollection rows = role.Rows.Query(queryParam);

            Assert.AreEqual(1, rows.Count);
        }
Esempio n. 4
0
        protected void MatrixTest(object sender, EventArgs e)
        {
            SOARolePropertiesQueryParam qp = new SOARolePropertiesQueryParam();

            qp.QueryName  = "AdminUnit";
            qp.QueryValue = "";
            OguDataCollection <IUser> users = GetUsersFromSOARole(new SOARolePropertiesQueryParamCollection()
            {
                qp
            });

            users.ForEach(p =>
            {
                Response.Output.WriteLine("<br/>" + p.LogOnName);
            });
        }
Esempio n. 5
0
        public void ReplaceUserInSOARoleTest()
        {
            SOARole role = PrepareSOARole();

            SOARolePropertiesQueryParam queryParam = new SOARolePropertiesQueryParam();

            queryParam.QueryName  = "CostCenter";
            queryParam.QueryValue = "1001";

            SOARolePropertyRowCollection rows = role.Rows.Query(queryParam);

            Assert.AreEqual(1, rows.Count);

            foreach (var rowUsers in rows.GenerateRowsUsers())
            {
                rowUsers.Users.ForEach(u => Console.WriteLine(u.LogOnName));
            }
        }
Esempio n. 6
0
        public void QueryRoleSingleRemovedProperty()
        {
            SOARole role = PrepareSOARole();

            role.PropertyDefinitions.Remove(spd => spd.Name == "CostCenter");

            SOARolePropertyDefinitionAdapter.Instance.Update(role, role.PropertyDefinitions);

            SOARole roleLoaded = new SOARole(role.FullCodeName);

            SOARolePropertiesQueryParam queryParam = new SOARolePropertiesQueryParam();

            queryParam.QueryName  = "CostCenter";
            queryParam.QueryValue = "1001";

            SOARolePropertyRowCollection rows = roleLoaded.Rows.Query(queryParam);

            Assert.AreEqual(0, rows.Count);
        }
Esempio n. 7
0
        public void FilterAndMergeEmptyActivityMatrixAndApprovalMatrixTest()
        {
            WfActivityMatrixResourceDescriptor resource = new WfActivityMatrixResourceDescriptor();

            SOARolePropertiesQueryParam queryParam = new SOARolePropertiesQueryParam();

            queryParam.QueryName  = "CostCenter";
            queryParam.QueryValue = "1001";

            WfApprovalMatrix approvalMatrix = ApprovalMatrixHelper.PrepareApprovalMatrix();

            SOARolePropertyRowCollection approvalRows = approvalMatrix.Rows.Query(queryParam);

            resource.Rows.MergeApprovalMatrix(resource.PropertyDefinitions, approvalRows, approvalMatrix.PropertyDefinitions);

            //输出的只有RowNumber。因为活动矩阵没有列
            resource.Rows.AssertAndOutputMatrixOperators();

            Assert.AreEqual(3, resource.Rows.Count);
        }
Esempio n. 8
0
        public void FilterAndMergeMatchedActiveMatrixWithRoleAndApprovalMatrixTest()
        {
            SOARolePropertiesQueryParam queryParam = new SOARolePropertiesQueryParam();

            queryParam.QueryName  = "CostCenter";
            queryParam.QueryValue = "1002";

            WfActivityMatrixResourceDescriptor resource = ActivityMatrixHelper.PrepareActivityMatrixResourceDescriptor();

            SOARolePropertyRowCollection activityRows = resource.Rows.Query(queryParam);

            int originalCount = activityRows.Count;

            WfApprovalMatrix approvalMatrix = ApprovalMatrixHelper.PrepareApprovalMatrix();

            SOARolePropertyRowCollection approvalRows = approvalMatrix.Rows.Query(queryParam);

            activityRows.MergeApprovalMatrix(resource.PropertyDefinitions, approvalRows, approvalMatrix.PropertyDefinitions);

            activityRows.AssertAndOutputMatrixOperators();

            Assert.AreEqual(3, activityRows.Count);
        }
        public void FilterAndMergeEmptyActivityMatrixAndApprovalMatrixTest()
        {
            WfActivityMatrixResourceDescriptor resource = new WfActivityMatrixResourceDescriptor();

            SOARolePropertiesQueryParam queryParam = new SOARolePropertiesQueryParam();

            queryParam.QueryName = "CostCenter";
            queryParam.QueryValue = "1001";

            WfApprovalMatrix approvalMatrix = ApprovalMatrixHelper.PrepareApprovalMatrix();

            SOARolePropertyRowCollection approvalRows = approvalMatrix.Rows.Query(queryParam);

            resource.Rows.MergeApprovalMatrix(resource.PropertyDefinitions, approvalRows, approvalMatrix.PropertyDefinitions);

            //输出的只有RowNumber。因为活动矩阵没有列
            resource.Rows.AssertAndOutputMatrixOperators();

            Assert.AreEqual(3, resource.Rows.Count);
        }
        public void FilterAndMergeMatchedActiveMatrixWithRoleAndApprovalMatrixTest()
        {
            SOARolePropertiesQueryParam queryParam = new SOARolePropertiesQueryParam();

            queryParam.QueryName = "CostCenter";
            queryParam.QueryValue = "1002";

            WfActivityMatrixResourceDescriptor resource = ActivityMatrixHelper.PrepareActivityMatrixResourceDescriptor();

            SOARolePropertyRowCollection activityRows = resource.Rows.Query(queryParam);

            int originalCount = activityRows.Count;

            WfApprovalMatrix approvalMatrix = ApprovalMatrixHelper.PrepareApprovalMatrix();

            SOARolePropertyRowCollection approvalRows = approvalMatrix.Rows.Query(queryParam);

            activityRows.MergeApprovalMatrix(resource.PropertyDefinitions, approvalRows, approvalMatrix.PropertyDefinitions);

            activityRows.AssertAndOutputMatrixOperators();

            Assert.AreEqual(3, activityRows.Count);
        }
        public void FilterAndMergeNotMatchedActivityMatrixAndApprovalMatrixTest()
        {
            SOARolePropertiesQueryParam queryParam = new SOARolePropertiesQueryParam();

            queryParam.QueryName = "CostCenter";
            queryParam.QueryValue = "1001";

            WfActivityMatrixResourceDescriptor resource = ActivityMatrixHelper.PrepareActivityMatrixResourceDescriptor();

            resource.Rows.ForEach(row => row.Values.FindByColumnName(SOARolePropertyDefinition.ActivityCodeColumn).Value = "NotMatched");

            SOARolePropertyRowCollection activityRows = resource.Rows.Query(queryParam);

            int originalActivityCount = activityRows.Count;

            WfApprovalMatrix approvalMatrix = ApprovalMatrixHelper.PrepareApprovalMatrix();

            SOARolePropertyRowCollection approvalRows = approvalMatrix.Rows.Query(queryParam);

            int originalApprovalCount = approvalMatrix.PropertyDefinitions.Count - 1;

            activityRows.MergeApprovalMatrix(resource.PropertyDefinitions, approvalRows, approvalMatrix.PropertyDefinitions);

            activityRows.AssertAndOutputMatrixOperators();

            Assert.AreEqual(originalActivityCount + originalApprovalCount, activityRows.Count);
        }
Esempio n. 12
0
		public void ReplaceUserInSOARoleTest()
		{
			SOARole role = PrepareSOARole();

			SOARolePropertiesQueryParam queryParam = new SOARolePropertiesQueryParam();

			queryParam.QueryName = "CostCenter";
			queryParam.QueryValue = "1001";

			SOARolePropertyRowCollection rows = role.Rows.Query(queryParam);

			Assert.AreEqual(1, rows.Count);

			foreach (var rowUsers in rows.GenerateRowsUsers())
			{
				rowUsers.Users.ForEach(u => Console.WriteLine(u.LogOnName));
			}
		}
Esempio n. 13
0
		public void QueryRoleSingleRemovedProperty()
		{
			SOARole role = PrepareSOARole();

			role.PropertyDefinitions.Remove(spd => spd.Name == "CostCenter");

			SOARolePropertyDefinitionAdapter.Instance.Update(role, role.PropertyDefinitions);

			SOARole roleLoaded = new SOARole(role.FullCodeName);

			SOARolePropertiesQueryParam queryParam = new SOARolePropertiesQueryParam();

			queryParam.QueryName = "CostCenter";
			queryParam.QueryValue = "1001";

			SOARolePropertyRowCollection rows = roleLoaded.Rows.Query(queryParam);

			Assert.AreEqual(0, rows.Count);
		}
Esempio n. 14
0
		public void QueryRoleSingleProperty()
		{
			SOARole role = PrepareSOARole();

			SOARolePropertiesQueryParam queryParam = new SOARolePropertiesQueryParam();

			queryParam.QueryName = "CostCenter";
			queryParam.QueryValue = "1001";

			SOARolePropertyRowCollection rows = role.Rows.Query(queryParam);

			Assert.AreEqual(1, rows.Count);
		}