public void ReturnAllStates()
        {
            var q = from d in StateInfoConfig.Dialogs
                    from s in d.States
                    select s;

            Assert.AreEqual(q.Count(), StateElements.Count());
        }
Esempio n. 2
0
        public void GetStateConditions(string systemWorkCondition, int countModule, int elementIndex)
        {
            BuildStateString();

            var moduleCondition = new ModuleCondition();

            for (var i = 0; i < countModule; i++)
            {
                var          index        = i + 1;
                PropertyInfo propertyInfo = moduleCondition.GetType().GetProperty("M" + index);
                propertyInfo.SetValue(moduleCondition, Convert.ChangeType(StateElements[i].State, propertyInfo.PropertyType), null);
            }
            var list = new List <ModuleCondition>();

            list.Add(moduleCondition);



            string whereClause = String.Format("m1 and m2");

            var queryResult = list
                              .Where(StringHelper.GetUpScript(systemWorkCondition)).Any();

            // see if it's a match


            if (queryResult)
            {
                StateType       = StateType.WorkingState;
                StateTypeString = Properties.Resources.WorkingState;
            }

            if (!queryResult)
            {
                if (StateElements[elementIndex].State == false && StateElements[elementIndex].AllRepairCount == StateElements[elementIndex].CurrentRepairCount)
                {
                    StateType       = StateType.RefusalState;
                    StateTypeString = Properties.Resources.RefusalState;
                }
                else if (StateElements.Any(w => w.AllRepairCount != w.CurrentRepairCount))
                {
                    StateType       = StateType.DowntimeState;
                    StateTypeString = Properties.Resources.DowntimeState;
                }
            }
        }
        public void SetYTo265ForAllDialog3States()
        {
            var states = StateElements.Where(s => s.State.Parent.Key == "D3" && s.Y != 265);

            Assert.AreEqual(0, states.Count());
        }
        public void SetHTo50ForAllDialog1States()
        {
            var states = StateElements.Where(s => s.State.Parent.Key == "D1" && s.H != 50);

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