Ejemplo n.º 1
0
        private static void HandleTrustExistanceSpecialCase(PackStatus packStatus, AdditionalChecks additionalChecks, AmountOfStockSubmited amountOfStockSubmited, NumberOfChecks numberOfChecks)
        {
            var chain1 = GraphProvider.GetQSimpleQSepAndHierSubQTableRuleChain(null, null,
                                                                               () => packStatus,
                                                                               () => true,
                                                                               () => amountOfStockSubmited,
                                                                               () => numberOfChecks,
                                                                               () => additionalChecks,
                                                                               () => false
                                                                               );

            Assert.That(RuleChainFulfilledResoveHelper.RuleChainIsFulfilled(chain1), Is.EqualTo(true));


            var chain2 = GraphProvider.GetQSimpleQSepAndHierSubQTableRuleChain(null, null,
                                                                               () => packStatus,
                                                                               () => false,
                                                                               () => amountOfStockSubmited,
                                                                               () => numberOfChecks,
                                                                               () => additionalChecks,
                                                                               () => false
                                                                               );

            Assert.That(RuleChainFulfilledResoveHelper.RuleChainIsFulfilled(chain2), Is.EqualTo(false));
        }
Ejemplo n.º 2
0
        public void MatrixTest(Status status,
                               AdditionalChecks additionalChecks,
                               AmountOfStockSubmited amountOfStockSubmited,
                               NumberOfChecks numberOfChecks,
                               bool expected)
        {
            var packStatus = GetPackStatusFor(status);

            // Специальный случай для голосования по доверенности
            if (packStatus == PackStatus.Simple &&
                additionalChecks == AdditionalChecks.HasTrust &&
                amountOfStockSubmited == AmountOfStockSubmited.LessOrEqualThanThereIsOnPack &&
                numberOfChecks == NumberOfChecks.Single)
            {
                HandleTrustExistanceSpecialCase(packStatus, additionalChecks, amountOfStockSubmited, numberOfChecks);
                return;
            }
            var chain1 = GraphProvider.GetQSimpleQSepAndHierSubQTableRuleChain(null, null,
                                                                               () => packStatus,
                                                                               () => true,
                                                                               () => amountOfStockSubmited,
                                                                               () => numberOfChecks,
                                                                               () => additionalChecks,
                                                                               () => false);
            var chain2 = GraphProvider.GetQSimpleQSepAndHierSubQTableRuleChain(null, null,
                                                                               () => packStatus,
                                                                               () => false,
                                                                               () => amountOfStockSubmited,
                                                                               () => numberOfChecks,
                                                                               () => additionalChecks,
                                                                               () => false);



            Assert.That(RuleChainFulfilledResoveHelper.RuleChainIsFulfilled(chain1), Is.EqualTo(expected));
            Assert.That(RuleChainFulfilledResoveHelper.RuleChainIsFulfilled(chain2), Is.EqualTo(expected));
        }