示例#1
0
        public void ConditionalArrangementTest()
        {
            DepartmentArrangementBuilder builder = new DepartmentArrangementBuilder(4, 2);

            builder.SetStartFinish(1, 3);

            builder.SetSimpleDepartment(1, new DepartmentWorker(1, 2, 2));
            builder.SetConditionalDepartment(2, 1, new DepartmentWorker(2, 1, 3), new DepartmentWorker(1, 2, 4));
            builder.SetSimpleDepartment(3, new DepartmentWorker(1, 2, 1));
            builder.SetSimpleDepartment(4, new DepartmentWorker(2, 1, 1));

            DepartmentArrangement arrangement = builder.Build();

            var(status, records) = arrangement.Query(4);

            Assert.AreEqual(DepartmentVisitStatus.Unvisited, status);
            Assert.IsTrue(ConvertRecords(2, records).Equals(""));

            (status, records) = arrangement.Query(3);

            Assert.AreEqual(DepartmentVisitStatus.Visited, status);

            (status, records) = arrangement.Query(2);

            Assert.IsTrue(ConvertRecords(2, records).Equals("01"));
        }
示例#2
0
        public void BasicArrangementTest()
        {
            DepartmentArrangementBuilder builder = new DepartmentArrangementBuilder(2, 2);

            builder.SetStartFinish(1, 2);

            builder.SetSimpleDepartment(1, new DepartmentWorker(1, 2, 2));
            builder.SetSimpleDepartment(2, new DepartmentWorker(2, 1, 1));

            DepartmentArrangement arrangement = builder.Build();

            var(status, records) = arrangement.Query(1);

            Assert.AreEqual(DepartmentVisitStatus.Visited, status);
            Assert.IsTrue(ConvertRecords(2, records).Equals("10"));
        }
示例#3
0
        public void MultipleRecordsTest()
        {
            DepartmentArrangementBuilder builder = new DepartmentArrangementBuilder(5, 3);

            builder.SetStartFinish(1, 4);

            builder.SetSimpleDepartment(1, new DepartmentWorker(1, 2, 2));
            builder.SetSimpleDepartment(2, new DepartmentWorker(3, 2, 3));
            builder.SetSimpleDepartment(3, new DepartmentWorker(2, 1, 1));
            builder.SetSimpleDepartment(4, new DepartmentWorker(1, 2, 5));
            builder.SetSimpleDepartment(5, new DepartmentWorker(1, 2, 4));

            DepartmentArrangement arrangement = builder.Build();

            var(status, records) = arrangement.Query(1);

            Assert.AreEqual(DepartmentVisitStatus.InfiniteLoop, status);
            Assert.IsTrue(ConvertRecords(3, records).Equals("100,101"));
        }