Example #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);
        }
Example #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);
			});
		}
Example #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);
        }
Example #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);
            });
        }
Example #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));
            }
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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));
			}
		}
Example #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);
		}
Example #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);
		}