Esempio n. 1
0
        public void TestInsertAction(InsertPosition insertPosition)
        {
            string firstPath            = Path.Combine(TestSupport.CreatedFilesDirectory, "first.xml");
            string secondPath           = Path.Combine(TestSupport.CreatedFilesDirectory, "second.xml");
            TestCasesRootContainer tcrc = new TestCasesRootContainer();

            tcrc.TestCasesRoot.Save(firstPath);
            SelectedValuesByConditionsAndActions selValues = new SelectedValuesByConditionsAndActions();

            selValues.CollectValues(tcrc.TestCasesRoot);
            selValues.Check(tcrc.TestCasesRoot);

            int    indexWhereToInsert = TestUtils.CalculateIndex(tcrc.TestCasesRoot.Conditions, insertPosition);
            string newActionName      = "new action" + DateTime.Now.ToString("F");
            int    actionCount        = tcrc.TestCasesRoot.Actions.Count;

            tcrc.TestCasesRoot.InsertAction(indexWhereToInsert, ActionObject.Create(newActionName, new ObservableCollection <EnumValue>()
            {
                new EnumValue("new test", "new value")
            }));

            TestUtils.CheckTestCasesAndConditionsAndActions(tcrc.TestCasesRoot);
            Assert.That(actionCount == 3); // adjust last testcase on failue
            Assert.That(tcrc.TestCasesRoot.Actions.Count == actionCount + 1);
            Assert.That(tcrc.TestCasesRoot.Actions[indexWhereToInsert].Name.Equals(newActionName));
            Assert.That(tcrc.ConditionChangeCount == 0);
            Assert.That(tcrc.ActionChangeCount == 2);
            selValues.InsertAction(insertPosition, tcrc.TestCasesRoot.TestCases.Count);
            selValues.Check(tcrc.TestCasesRoot);

            tcrc.TestCasesRoot.Save(secondPath);
            // only for manual check of testcase
            //TestSupport.CompareFile(firstPath, secondPath);
        }
Esempio n. 2
0
        public void TestAddAction()
        {
            string firstPath            = Path.Combine(TestSupport.CreatedFilesDirectory, "first.xml");
            string secondPath           = Path.Combine(TestSupport.CreatedFilesDirectory, "second.xml");
            TestCasesRootContainer tcrc = new TestCasesRootContainer();

            tcrc.TestCasesRoot.Save(firstPath);
            SelectedValuesByConditionsAndActions selValues = new SelectedValuesByConditionsAndActions();

            selValues.CollectValues(tcrc.TestCasesRoot);
            selValues.Check(tcrc.TestCasesRoot);

            string newActionName = "new action" + DateTime.Now.ToString("F");
            int    actionCount   = tcrc.TestCasesRoot.Actions.Count;

            tcrc.TestCasesRoot.AppendAction(ActionObject.Create(newActionName, new ObservableCollection <EnumValue>()
            {
                new EnumValue("new test", "new value")
            }));

            TestUtils.CheckTestCasesAndConditionsAndActions(tcrc.TestCasesRoot);
            Assert.That(tcrc.TestCasesRoot.Actions.Count == actionCount + 1);
            Assert.That(tcrc.TestCasesRoot.Actions.Last().Name.Equals(newActionName));
            Assert.That(tcrc.ConditionChangeCount == 0);
            Assert.That(tcrc.ActionChangeCount == 2);
            selValues.AppendAction(tcrc.TestCasesRoot.TestCases.Count);
            selValues.Check(tcrc.TestCasesRoot);

            tcrc.TestCasesRoot.Save(secondPath);
            // only for manual check of testcase
            //TestSupport.CompareFile(firstPath, secondPath);
        }