private void CreateSimpleTableInternal(int conditionCount = 3, int actionCount = 3)
        {
            List <ObservableCollection <EnumValue> > lists = new List <ObservableCollection <EnumValue> >();
            int listNumber    = 0;
            int enumIdx       = 0;
            var subListSample = new ObservableCollection <EnumValue>();

            lists.Add(subListSample);
            subListSample.Add(new EnumValue(String.Format("{0}-Invalid-{1}-Default", listNumber, enumIdx++), true, false, true));
            subListSample.Add(new EnumValue(String.Format("{0}-EnumValue-{1}", listNumber, enumIdx++), false, false, false));
            subListSample.Add(new EnumValue(String.Format("{0}-EnumValue-{1}", listNumber, enumIdx++), false, false, false));
            subListSample.Add(new EnumValue(String.Format("{0}-Don' t care-{1}", listNumber++, enumIdx++), false, true, false));
            enumIdx       = 0;
            subListSample = new ObservableCollection <EnumValue>();
            lists.Add(subListSample);
            subListSample.Add(new EnumValue(String.Format("{0}-Invalid-{1}", listNumber, enumIdx++), true, false, false));
            subListSample.Add(new EnumValue(String.Format("{0}-EnumValue-{1}-Default", listNumber, enumIdx++), false, false, true));
            subListSample.Add(new EnumValue(String.Format("{0}-EnumValue-{1}", listNumber, enumIdx++), false, false, false));
            subListSample.Add(new EnumValue(String.Format("{0}-Don' t care-{1}", listNumber++, enumIdx++), false, true, false));
            enumIdx       = 0;
            subListSample = new ObservableCollection <EnumValue>();
            lists.Add(subListSample);
            subListSample.Add(new EnumValue(String.Format("{0}-Invalid-{1}", listNumber, enumIdx++), true, false, false));
            subListSample.Add(new EnumValue(String.Format("{0}-EnumValue-{1}", listNumber, enumIdx++), false, false, false));
            subListSample.Add(new EnumValue(String.Format("{0}-EnumValue-{1}", listNumber, enumIdx++), false, false, false));
            subListSample.Add(new EnumValue(String.Format("{0}-Don' t care-{1}-Default", listNumber++, enumIdx++), false, true, true));
            enumIdx       = 0;
            subListSample = new ObservableCollection <EnumValue>();
            lists.Add(subListSample);
            subListSample.Add(new EnumValue(String.Format("{0}-Invalid-{1}-Default", listNumber, enumIdx++), true, false, true));
            subListSample.Add(new EnumValue(String.Format("{0}-EnumValue-{1}", listNumber, enumIdx++), false, false, false));
            subListSample.Add(new EnumValue(String.Format("{0}-EnumValue-{1}", listNumber, enumIdx++), false, false, false));
            subListSample.Add(new EnumValue(String.Format("{0}-Don' t care-{1}", listNumber++, enumIdx++), false, true, false));
            enumIdx       = 0;
            subListSample = new ObservableCollection <EnumValue>();
            lists.Add(subListSample);
            subListSample.Add(new EnumValue(String.Format("{0}-Invalid-{1}", listNumber, enumIdx++), true, false, false));
            subListSample.Add(new EnumValue(String.Format("{0}-EnumValue-{1}-Default", listNumber, enumIdx++), false, false, true));
            subListSample.Add(new EnumValue(String.Format("{0}-EnumValue-{1}", listNumber, enumIdx++), false, false, false));
            subListSample.Add(new EnumValue(String.Format("{0}-Don' t care-{1}", listNumber++, enumIdx++), false, true, false));
            enumIdx       = 0;
            subListSample = new ObservableCollection <EnumValue>();
            lists.Add(subListSample);
            subListSample.Add(new EnumValue(String.Format("{0}-Invalid-{1}", listNumber, enumIdx++), true, false, false));
            subListSample.Add(new EnumValue(String.Format("{0}-EnumValue-{1}", listNumber, enumIdx++), false, false, false));
            subListSample.Add(new EnumValue(String.Format("{0}-EnumValue-{1}", listNumber, enumIdx++), false, false, false));
            subListSample.Add(new EnumValue(String.Format("{0}-Don' t care-{1}-Default", listNumber++, enumIdx++), false, true, true));

            int listIndex = 0;

            for (int idx = 1; idx <= conditionCount; idx++)
            {
                Conditions.Add(ConditionObject.Create(String.Format("Condition {0}", idx), lists[listIndex++]));
            }

            for (int idx = 1; idx <= actionCount; idx++)
            {
                Actions.Add(ActionObject.Create(String.Format("Action1{0}", idx), lists[listIndex++]));
            }
        }
Exemplo n.º 2
0
        private void Load(XmlElement element, out ConditionObject condition)
        {
            string name = element.GetAttributeStringValue(XmlNames.NameAttributeName);

            // only enums are supported by conditions ValueDataType type = element.GetAttributeEnumValue<ValueDataType>(XmlNames.TypeAttributeName);
            condition             = ConditionObject.Create(name);
            condition.LoadSaveId  = element.GetAttributeIntValue(XmlNames.IdAttributeName, XmlElementOption.MustHaveValue);
            condition.DefaultText = element.GetAttributeStringValue(XmlNames.DefaultTextAttributeName, XmlElementOption.Optional);
            condition.DefaultBool = element.GetAttributeBoolValue(XmlNames.DefaultBoolAttributeName);
            condition.TooltipText = element.GetAttributeStringValue(XmlNames.TooltipTextAttributeName);

            LoadEnumValues(element, condition);
        }
        private void CreateSampleProjectInternal()
        {
            var enumList = new ObservableCollection <EnumValue>();

            enumList.Add(new EnumValue("invalid condition", true, false, true, "this is an invalid condition please choose an other value"));
            enumList.Add(new EnumValue("Printer is printing", false, false, false, "everything is ok"));
            enumList.Add(new EnumValue("Printer is not printing", false, false, false, "problems with printing or printing quality"));
            enumList.Add(new EnumValue("DC", false, true, false, "don't care this condition in this case"));

            Conditions.Add(ConditionObject.Create("Basic Printer status", enumList));

            enumList = new ObservableCollection <EnumValue>();
            enumList.Add(new EnumValue("invalid condition", true, false, true, "this is an invalid condition please choose an other value"));
            enumList.Add(new EnumValue("LED is on", false, false, false, "Power LED is on"));
            enumList.Add(new EnumValue("LED is flashing", false, false, false, "Power LED is flashing"));
            enumList.Add(new EnumValue("LED is off", false, false, false, "Power LED is off"));
            enumList.Add(new EnumValue("DC", false, true, false, "don't care this condition in this case"));

            Conditions.Add(ConditionObject.Create("Green LED", enumList));

            enumList = new ObservableCollection <EnumValue>();
            enumList.Add(new EnumValue("invalid condition", true, false, true, "this is an invalid condition please choose an other value"));
            enumList.Add(new EnumValue("Blank sheet is ejected", false, false, false, "Printer ejects only blank sheets"));
            enumList.Add(new EnumValue("Print quality is bad", false, false, false, "Printer output has bad quality"));
            enumList.Add(new EnumValue("Nothing is ejected", false, false, false, "Printer don't eject a sheet"));
            enumList.Add(new EnumValue("DC", false, true, false, "don't care this condition in this case"));

            Conditions.Add(ConditionObject.Create("Paper", enumList));


            enumList = new ObservableCollection <EnumValue>();
            enumList.Add(new EnumValue("", false, false, true, "nothing to do"));
            enumList.Add(new EnumValue("Check connection", false, false, false, "Check the printer power connection"));

            Actions.Add(ActionObject.Create("Power", enumList));

            enumList = new ObservableCollection <EnumValue>();
            enumList.Add(new EnumValue("", false, false, true, "nothing to do"));
            enumList.Add(new EnumValue("Check filling level", false, false, false, "Check the fill level of the ink cartridges"));

            Actions.Add(ActionObject.Create("Ink catridge", enumList));

            enumList = new ObservableCollection <EnumValue>();
            enumList.Add(new EnumValue("", false, false, true, "nothing to do"));
            enumList.Add(new EnumValue("Check connection", false, false, false, "Check the printer computer connection"));

            Actions.Add(ActionObject.Create("PC connection", enumList));

            enumList = new ObservableCollection <EnumValue>();
            enumList.Add(new EnumValue("", false, false, true, "nothing to do"));
            enumList.Add(new EnumValue("Check paper filling level", false, false, false, "Does the printer contain enough paper?"));
            enumList.Add(new EnumValue("Check for clean (unused) paper", false, false, false, "Does the printer contain blank paper?"));

            Actions.Add(ActionObject.Create("Paper", enumList));

            int      idx = 1;
            TestCase tc  = AddTestCase();

            tc.DisplayIndex = idx++;
            SetSelectedItemIndex(tc, new int[] { 1, 4, 4 }, new int[0]);
            tc.Description = "This is the description of TestCase 1";

            tc = AddTestCase();
            tc.DisplayIndex = idx++;
            SetSelectedItemIndex(tc, new int[] { 2, 3, 4 }, new int[] { 1 });
            tc.Description = "This is the description of TestCase 2";

            tc = AddTestCase();
            tc.DisplayIndex = idx++;
            SetSelectedItemIndex(tc, new int[] { 2, 2, 4 }, new int[] { 0, 1, 0, 1 });
            tc.Description = "This is the description of TestCase 3";

            tc = AddTestCase();
            tc.DisplayIndex = idx++;
            SetSelectedItemIndex(tc, new int[] { 2, 1, 1 }, new int[] { 0, 1, 0, 0 });
            tc.Description = "This is the description of TestCase 4";

            tc = AddTestCase();
            tc.DisplayIndex = idx++;
            SetSelectedItemIndex(tc, new int[] { 2, 1, 2 }, new int[] { 0, 1, 0, 2 });
            tc.Description = "This is the description of TestCase 5";

            tc = AddTestCase();
            tc.DisplayIndex = idx++;
            SetSelectedItemIndex(tc, new int[] { 2, 1, 3 }, new int[] { 0, 0, 1, 1 });
            tc.Description = "This is the description of TestCase 6";

            this.Description = "This is the description of the sample project";
        }