protected void setUp()
        {
            //test a combination from 3 elements
            structure = new TestCasesStructure();
            Element          elem1 = new Element(structure);
            EquivalenceClass eq11  = new EquivalenceClass(elem1);
            EquivalenceClass eq12  = new EquivalenceClass(elem1);
            EquivalenceClass eq13  = new EquivalenceClass(elem1);
            Element          elem2 = new Element(structure);
            EquivalenceClass eq21  = new EquivalenceClass(elem2);
            EquivalenceClass eq22  = new EquivalenceClass(elem2);
            EquivalenceClass eq23  = new EquivalenceClass(elem2);
            Element          elem3 = new Element(structure);
            EquivalenceClass eq31  = new EquivalenceClass(elem3);
            EquivalenceClass eq32  = new EquivalenceClass(elem3);
            EquivalenceClass eq33  = new EquivalenceClass(elem3);

            dep = new Dependency(structure);
            foreach (Element element in structure.Elements)
            {
                dep.AddElement(element);
                foreach (EquivalenceClass equivalenceClass in element.EquivalenceClasses)
                {
                    dep.AddEquivalenceClass(equivalenceClass);
                }
            }

            combi1 = new Combination(dep);
            combi2 = new Combination(dep);
            combi3 = new Combination(dep);
            combi4 = new Combination(dep);

            combi1.AddEquivalenceClass(eq11);
            combi1.AddEquivalenceClass(eq22);
            combi1.AddEquivalenceClass(eq33);


            combi2.AddEquivalenceClass(eq21);
            combi2.AddEquivalenceClass(eq11);
            combi2.AddEquivalenceClass(eq32);

            combi3.AddEquivalenceClass(eq13);
            combi3.AddEquivalenceClass(eq23);
            combi3.AddCombination(combi4);

            test1 = new TestCase(structure);
            test2 = new TestCase(structure);


            test1.AddCombination(combi1);
            test1.AddEquivalenceClass(eq23);
            test1.AddEquivalenceClass(eq33);
            test1.AddCombination(combi4);

            test2.AddCombination(combi3);
            test2.AddCombination(combi4);
        }
        public void GeneratedDescriptionTest()
        {
            TestCase tc1 = new TestCase(structure);

            tc1.Combinations.Add(combi2);
            tc1.Combinations.Add(combi3);
            tc1.EquivalenceClasses.Add(eq13);
            tc1.EquivalenceClasses.Add(eq22);
            Assert.AreEqual(tc1.GeneratedDescription, "[D1.C1:(Element Untitled 2='') AND (Element Untitled 1='') AND (Element Untitled 3='')]\n AND [D1.C2:(Element Untitled 1='') AND (Element Untitled 2='') AND (Element Untitled 3='')]\n AND (Element Untitled 1='')\n AND (Element Untitled 2='')");
        }
        public void ITestCasesBean()
        {
            TestCase tc = new TestCase(to.TestCasesStruct);

            dao.Save();
            to.TestCasesStruct.RemoveTestCase(tc);
            dao.DeleteItem(tc);
            TestCase tc2 = dao.GetItem(tc.GetType(), tc.Id) as TestCase;

            Assert.IsNull(tc2);
        }
Exemple #4
0
        public void CreateRemoveTestCaseEditTest()
        {
            TestCasesStructure structure = new TestCasesStructure();
            TestCase           testCase  = new TestCase(structure);

            ce.AddEdit(EditFactory.instance.CreateRemoveTestCaseEdit(structure, testCase));
            structure.RemoveTestCase(testCase);
            ce.End();
            ce.Undo();
            Assert.IsTrue(structure.TestCases.Contains(testCase));
            ce.Redo();
            Assert.IsFalse(structure.TestCases.Contains(testCase));
        }
        public void ITestCasesBean()
        {
            DefaultDAO dao = new DefaultDAO(to.TestCasesStruct);

            StdCombination stdComb = new StdCombination(to.TestCasesStruct);
            TestCase       tc      = new TestCase(to.TestCasesStruct);

            stdComb.AddTestCase(tc);

            dao.Save();
            stdComb.RemoveTestCase(tc);
            to.TestCasesStruct.RemoveStdCombination(stdComb);
            dao.DeleteItem(stdComb);
            to.TestCasesStruct.RemoveTestCase(tc);
            dao.DeleteItem(tc);
            dao.Save();
        }
        public void ICombinationsBean()
        {
            TestCase    tc   = new TestCase(to.TestCasesStruct);
            DefaultDAO  dao  = new DefaultDAO(to.TestCasesStruct);
            Dependency  dep  = new Dependency(to.TestCasesStruct);
            Combination comb = new Combination(dep);

            tc.AddCombination(comb);
            dao.Save();
            Assert.IsNotNull(dao.GetItem(tc.GetType(), tc.Id));
            Assert.IsNotNull(dao.GetItem(comb.GetType(), comb.Id));
            tc.RemoveCombination(comb);
            dep.RemoveCombination(comb);
            dao.DeleteItem(comb);
            to.TestCasesStruct.RemoveTestCase(tc);
            dao.DeleteItem(tc);
            to.TestCasesStruct.RemoveDependency(dep);
            dao.DeleteItem(dep);
        }
        public void IEquivalenceClassesBean()
        {
            TestCase         tc               = new TestCase(to.TestCasesStruct);
            DefaultDAO       dao              = new DefaultDAO(to.TestCasesStruct);
            Element          elem             = new Element(to.TestCasesStruct);
            EquivalenceClass equivalenceClass = new EquivalenceClass(elem);

            tc.AddEquivalenceClass(equivalenceClass);
            dao.Save();
            Assert.IsNotNull(dao.GetItem(tc.GetType(), tc.Id));
            Assert.IsNotNull(dao.GetItem(equivalenceClass.GetType(), equivalenceClass.Id));
            tc.RemoveEquivalenceClass(equivalenceClass);
            elem.RemoveEquivalenceClass(equivalenceClass);
            dao.DeleteItem(equivalenceClass);
            to.TestCasesStruct.RemoveTestCase(tc);
            dao.DeleteItem(tc);
            to.TestCasesStruct.RemoveElement(elem);
            dao.DeleteItem(elem);
        }
        public void Validate()
        {
            TestCase   testcase   = new TestCase(to.TestCasesStruct);
            TestCase   testcase1  = new TestCase(to.TestCasesStruct);
            DefaultDAO elementDAO = new DefaultDAO(to.TestCasesStruct);

            testcase.Position = testcase1.Position;
            try
            {
                elementDAO.Save();
            }catch (Exception e)
            {
                throw e;
            }finally
            {
                to.TestCasesStruct.RemoveTestCase(testcase1);
                to.TestCasesStruct.RemoveTestCase(testcase);
            }
        }
        public void EqualsByRelationsTest()
        {
            TestCase tc1 = new TestCase(structure);
            TestCase tc2 = new TestCase(structure);

            tc1.Combinations.Add(combi2);
            tc1.Combinations.Add(combi3);
            tc1.EquivalenceClasses.Add(eq13);
            tc1.EquivalenceClasses.Add(eq22);

            tc2.Combinations.Add(combi2);
            tc2.Combinations.Add(combi3);
            tc2.EquivalenceClasses.Add(eq13);
            tc2.EquivalenceClasses.Add(eq22);

            Assert.IsTrue(tc1.EqualsByRelations(tc2));
            tc1.RemoveCombination(combi3);

            Assert.IsFalse(tc1.EqualsByRelations(tc2));
        }