Exemplo n.º 1
0
        public void MyTestInitialize()
        {
            ElementData = new Dictionary<DTElement, List<DTState>>();
            Random rnd = new Random();
            for (int i = 0; i < 10; i++)
            {
                DTElement element = new DTElement
                {
                    Name = string.Format("Element {0}", i),
                    Kind = rnd.Next(1) == 0 ? DTElementKind.Condition : DTElementKind.Action
                };
                List<DTState> states = new List<DTState>();
                for (int stateIndex = 0; stateIndex < 10; stateIndex++)
                    states.Add(rnd.Next(1) == 0 ? DTState.Yes : DTState.No);

                ElementData.Add(element, states);
            }
        }
Exemplo n.º 2
0
        private void CalculateRuleCountTestCase3()
        {
            DTState stateA = new DTState { Name = "A" };
            DTState stateB = new DTState { Name = "B" };

            List<DTElement> elements = new List<DTElement>();
            for (int i = 0; i < 3; i++)
            {
                DTElement newDTElement = new DTElement { Name = string.Format("Condition {0}", i), Kind = DTElementKind.Condition };
                elements.Add(newDTElement);
            }
            for (int i = 0; i < 2; i++)
                elements.Add(new DTElement { Name = string.Format("Action {0}", i), Kind = DTElementKind.Action });

            elements[0].AddValidState(stateA);
            elements[0].AddValidState(stateB);

            elements[1].AddValidState(stateA);

            int expected = 24;
            int actual = DTRuleSet_Accessor.CalculateRuleCount(elements);
            Assert.AreEqual(expected, actual);
        }