예제 #1
0
        public void resolves_process_role_map()
        {
            var ctx = EPTest.Compile(@"
orgnode A
	process Ax
	orgnode B
		process Bx
			in Ax
		process Cx
			in Bx
");

            var map = ctx.ExtraEcoProcessRoleMap();

            Console.WriteLine(map.ToString());
            Action <string, string> hasmap = (from, to) =>
            {
                Assert.NotNull(
                    map.Elements().FirstOrDefault(
                        x => x.Attr("from") == from && x.Attr("to") == to));
            };

            hasmap("A", "Ax_OWN");
            hasmap("B", "Bx_OWN");
            hasmap("B", "Cx_OWN");
            hasmap("Bx_OWN", "Ax_VIEW");
            hasmap("Cx_OWN", "Bx_VIEW");
        }
        public void provides_process_to_thema_SIMPLE()
        {
            var ctx =
                EPTest.Compile(
                    @"
orgnode A
	process Ax
		thema At
thema At
	activeA = true
	activeB = true
	in A
	out aA
	in B
	out aB
");
            var p  = ctx.EcoProcessIndex.Index["Ax"];
            var t  = ctx.Themas["At"];
            var ra = t.Items["aA.out"];
            var fa = t.Items["A.in"];
            var rb = t.Items["aB.out"];
            var fb = t.Items["B.in"];

            Assert.True(t.IsUnderEcoProcess);
            Assert.AreEqual("At", p.ThemaRefs.First().Thema.Code);
            Assert.AreEqual(p.Code, t.OwnerProcessA);
            Assert.AreEqual(p.Code, t.OwnerProcessB);
            Assert.AreEqual(p.Code, t.EcoProcess);
            Assert.AreEqual("Ax_OWN; Ax_VIEW; At_OWN; At_VIEW", t.Role);
            Assert.AreEqual("Ax_OWN; At_FORM_A_OWN", fa.Attr("role"));
            Assert.AreEqual("Ax_OWN; At_REPORT_VIEW", ra.Attr("role"));
            Assert.AreEqual("Ax_OWN; At_FORM_B_OWN", fb.Attr("role"));
            Assert.AreEqual("Ax_OWN; At_REPORT_VIEW", rb.Attr("role"));
        }
예제 #3
0
        public void prevents_non_coded_orgnodes()
        {
            var ctx = EPTest.Compile(@"
orgnode A
	orgnode
		orgnode C
");

            Assert.False(ctx.IsComplete);
            Assert.NotNull(ctx.Errors.FirstOrDefault(x => x.ErrorCode == "ER_EPI02"));
        }
예제 #4
0
        public void prevent_outlock_without_outview()
        {
            var ctx = EPTest.Compile(@"
orgnode A
	process Ax
		thema A outlock
thema A
");

            Assert.False(ctx.IsComplete);
            Assert.NotNull(ctx.Errors.FirstOrDefault(x => x.ErrorCode == "ER_EPI03"));
        }
예제 #5
0
        public void not_process_eco_processes_if_option_not_setted_up()
        {
            var ctx = EPTest.Compile(
                @"
orgnode X
	orgnode Y
", x => x.UseEcoProcess = false
                );
            XElement e = null;

            Assert.Null(e = ctx.ExtraData.Element("ecoprocess_rolemap"));
        }
        public void prevents_references_to_not_existed_themas()
        {
            var ctx = EPTest.Compile(@"
orgnode A
	process Ax
		thema At2
thema At
");

            Assert.False(ctx.IsComplete);
            Assert.NotNull(ctx.Errors.FirstOrDefault(x => x.ErrorCode == "ER_EPI05"));
        }
예제 #7
0
        public void Prevents_not_orgnoded_processes()
        {
            var ctx = EPTest.Compile(@"
orgnode A
	orgnode B
process Ax, orgnode =A
process Bx, orgnode =B
process Cx
");

            Assert.False(ctx.IsComplete);
            Assert.NotNull(ctx.Errors.FirstOrDefault(x => x.ErrorCode == "ER_EPI03"));
        }
예제 #8
0
        public void builds_role_mapping_tree()
        {
            var ctx  = EPTest.Compile(@"
orgnode A
	orgnode B
		orgnode C
");
            var maps = ctx.ExtraEcoProcessRoleMap().Elements();

            Assert.AreEqual(2, maps.Count());
            Assert.NotNull(maps.FirstOrDefault(x => x.Attr("from") == "A" && x.Attr("to") == "B"));
            Assert.NotNull(maps.FirstOrDefault(x => x.Attr("from") == "B" && x.Attr("to") == "C"));
        }
예제 #9
0
        public void process_eco_processes_if_option_setted_up()
        {
            var ctx = EPTest.Compile(
                @"
orgnode X
	orgnode Y
"
                );
            XElement e = null;

            Assert.NotNull(e = ctx.ExtraData.Element("ecoprocess_rolemap"));
            Assert.NotNull(e.Elements("map").FirstOrDefault(x => x.Attr("from") == "X" && x.Attr("to") == "Y"));
        }
        public void warning_mode_to_prevent_references_to_not_existed_themas()
        {
            var ctx = EPTest.Compile(@"
orgnode A
	process Ax
		thema At2
thema At
",
                                     x => x.NonResolvedProcessThemaRefIsError = false);

            Assert.True(ctx.IsComplete);
            Assert.NotNull(ctx.Errors.FirstOrDefault(x => x.ErrorCode == "WR_EPI05"));
        }
예제 #11
0
        public void resolves_org_node()
        {
            var ctx = EPTest.Compile(@"
orgnode A
	process Ax
	orgnode B
		process Bx
		process Cx
");

            Assert.AreEqual(3, ctx.EcoProcessIndex.Index.Count);
            Assert.AreEqual("A", ctx.EcoProcessIndex["Ax"].OrgNode.Code);
            Assert.AreEqual("B", ctx.EcoProcessIndex["Bx"].OrgNode.Code);
            Assert.AreEqual("B", ctx.EcoProcessIndex["Cx"].OrgNode.Code);
        }
예제 #12
0
        public void prevent_self_coded_process_in()
        {
            var ctx = EPTest.Compile(@"
orgnode A
	process Ax
	orgnode B
		process Bx
			in Bx
		process Cx
			in Bx
");

            Assert.False(ctx.IsComplete);
            Assert.NotNull(ctx.Errors.FirstOrDefault(x => x.ErrorCode == "ER_EPI04"));
        }
예제 #13
0
        public void can_read_outer_to_org_node()
        {
            var ctx =
                EPTest.Compile(@"
orgnode A
	orgnode B
process Ax, orgnode =A
process Bx, orgnode =B
process Cx, orgnode =B
");

            Assert.AreEqual(3, ctx.EcoProcessIndex.Index.Count);
            Assert.AreEqual("A", ctx.EcoProcessIndex["Ax"].OrgNodeCode);
            Assert.AreEqual("B", ctx.EcoProcessIndex["Bx"].OrgNodeCode);
            Assert.AreEqual("B", ctx.EcoProcessIndex["Cx"].OrgNodeCode);
        }
예제 #14
0
        public void prevent_recoursive_process_in()
        {
            var ctx =
                EPTest.Compile(@"
orgnode A
	process Ax
		in Cx
	orgnode B
		process Bx
			in Ax
		process Cx
			in Bx
");

            Assert.False(ctx.IsComplete);
            Assert.AreEqual(3, ctx.Errors.Where(x => x.ErrorCode == "ER_EPINTEG_3").Count());
        }
예제 #15
0
        public void resolves_process_in()
        {
            var ctx = EPTest.Compile(@"
orgnode A
	process Ax
	orgnode B
		process Bx
			in Ax
		process Cx
			in Bx
");

            Assert.AreEqual("Ax", ctx.EcoProcessIndex.Index["Bx"].InDepends.First().Process.Code);
            Assert.AreEqual("Bx", ctx.EcoProcessIndex.Index["Ax"].OutDepends.First().Process.Code);
            Assert.AreEqual("Bx", ctx.EcoProcessIndex.Index["Cx"].InDepends.First().Process.Code);
            Assert.AreEqual("Cx", ctx.EcoProcessIndex.Index["Bx"].OutDepends.First().Process.Code);
        }
        public void process_in_dependency_injected()
        {
            var ctx =
                EPTest.Compile(
                    @"
orgnode A
	process Ax
		thema a1, outview, outlock
	process Ax2
		in Ax
		thema a2, outview, outlock
	process Ax3
		in Ax2
		thema a3

thema A, abst
	activeA = true
	activeB = true
	in A
	in B
A a1
A a2
A a3
");
            var p   = ctx.EcoProcessIndex.Index["Ax"];
            var t1  = ctx.Themas["a1"];
            var t2  = ctx.Themas["a2"];
            var t3  = ctx.Themas["a3"];
            var f1a = t1.Items["A.in"];
            var f1b = t1.Items["B.in"];
            var f2a = t2.Items["A.in"];
            var f2b = t2.Items["B.in"];
            var f3a = t3.Items["A.in"];
            var f3b = t3.Items["B.in"];

            Assert.Null(f1a.Elements().FirstOrDefault(x => x.Name.LocalName == "lockdepend"));
            Assert.Null(f1b.Elements().FirstOrDefault(x => x.Name.LocalName == "lockdepend"));
            Assert.NotNull(f2a.Elements().FirstOrDefault(x => x.Name.LocalName == "lockdepend" && x.Attr("code") == "a1.A.in"));
            Assert.NotNull(f2b.Elements().FirstOrDefault(x => x.Name.LocalName == "lockdepend" && x.Attr("code") == "a1.B.in"));
            Assert.NotNull(f3a.Elements().FirstOrDefault(x => x.Name.LocalName == "lockdepend" && x.Attr("code") == "a2.A.in"));
            Assert.NotNull(f3b.Elements().FirstOrDefault(x => x.Name.LocalName == "lockdepend" && x.Attr("code") == "a2.B.in"));
            Assert.Null(f3a.Elements().FirstOrDefault(x => x.Name.LocalName == "lockdepend" && x.Attr("code") == "a1.A.in"));
            Assert.Null(f3b.Elements().FirstOrDefault(x => x.Name.LocalName == "lockdepend" && x.Attr("code") == "a1.B.in"));
        }
예제 #17
0
        public void can_read_embeded_to_org_node()
        {
            var ctx = EPTest.Compile(@"
orgnode A, An
	process Ax, An
	orgnode B
		process Bx
		process Cx
");

            Assert.AreEqual(3, ctx.EcoProcessIndex.Index.Count);
            Assert.AreEqual("A", ctx.EcoProcessIndex["Ax"].OrgNodeCode);
            Assert.AreEqual("B", ctx.EcoProcessIndex["Bx"].OrgNodeCode);
            Assert.AreEqual("B", ctx.EcoProcessIndex["Cx"].OrgNodeCode);
            Assert.AreEqual("B", ctx.EcoProcessIndex["Cx"].OrgNodeCode);
            Assert.AreEqual("An", ctx.EcoProcessIndex["Ax"].Name);
            Assert.AreEqual(1, ctx.OrgNodeIndex.Roots.Count());
            Assert.AreEqual("A", ctx.OrgNodeIndex.Roots.First().Code);
            Assert.AreEqual("An", ctx.OrgNodeIndex.Roots.First().Name);
        }
        public void hole_in_stages_prevented()
        {
            var ctx =
                EPTest.Compile(
                    @"
orgnode A
	process Ax
		thema a1, stage = 1
		thema a2, stage = 2
		thema a3, stage = 4
thema A, abst
	activeA = true
	activeB = true
	in A
	in B
A a1
A a2
A a3
");

            Assert.False(ctx.IsComplete);
            Assert.NotNull(ctx.Errors.FirstOrDefault(x => x.ErrorCode == "ER_EPINTEG_2"));
        }
        public void hole_in_stages_prevented_noref()
        {
            var ctx =
                EPTest.Compile(
                    @"
orgnode A
	process Ax
		thema a1, stage = 1
		thema a4, stage = 2
		thema a3, stage = 3
thema A, abst
	activeA = true
	activeB = true
	in A
	in B
A a1
A a2
A a3
",
                    x => x.NonResolvedProcessThemaRefIsError = false);

            Assert.False(ctx.IsComplete);
            Assert.NotNull(ctx.Errors.FirstOrDefault(x => x.ErrorCode == "ER_EPINTEG_2"));
        }