Example #1
0
        public void ConstraintTriggersForSingleValue()
        {
            Constraint c = new Constraint(F1, F2, (x) => { return(x.Any(y => (new[] { 1, 2 }).Contains((int)y))); }, new List <object> {
                4
            });
            var val = F1.GetValidCombinations(1, 1).valueCombinations[0];

            Assert.IsTrue(c.IsActive(F1, val));
        }
Example #2
0
        public void Facette_GetValidCombinations_SelectsAllBits_TwoBits()
        {
            List <BitArray> allCombinations = new List <BitArray>
            {
                new BitArray(new[] { true, true, false }),   // b011
                new BitArray(new[] { true, false, true }),   // b101
                new BitArray(new[] { false, true, true }),   // b110
            };

            var fac = new Facette("Facetto", new List <object> {
                1, 2, 3
            });

            Facette.SelectResult res = new Facette.SelectResult();
            res             = fac.GetValidCombinations(2, 2);
            allCombinations = allCombinations.Where(x => !res.valueCombinations.Any(y => y.SameAs(x))).ToList();

            Assert.AreEqual(0, allCombinations.Count);
        }