Exemplo n.º 1
0
 public GenerationState()
 {
     TestCaseCollection = new TestCaseCollectionManager();
     Template = new TemplateManager();
     Settings = new SettingsManager();
     List = new TestListManager();
     Suite = new TestSuiteManager();
 }
        public void Copy_SimpleMasterWithCopiedAlreadyLoaded_CopyIsNotAllowed()
        {
            var manager = new TestCaseCollectionManager();
            var master = manager.Item("master");
            Load(master.Content, new string[] { "a11,a12", "a11,a22", "a21,a32" }, "alpha1,alpha2");

            var copied = manager.Item("copied");
            Load(copied.Content, new string[] { "b11,b12", "b11,b22" }, "beta1,beta2");

            Assert.Throws<ArgumentException>(delegate { manager.Copy("master", "copied"); });
        }
        public void Cross_ThreeTimesTwoOnItself_SixRowsFiveColumns()
        {
            var manager = new TestCaseCollectionManager();
            var tc1 = manager.Item("alpha");
            Load(tc1.Content, new string[] { "a11,a12", "a21,a22", "a31,a32" }, "alpha1,alpha2");
            var tc2 = manager.Item("beta");
            Load(tc2.Content, new string[] { "b11,b12,b13", "b21,b22,b23" }, "beta1,beta2,beta3");

            manager.Cross("alpha", "beta");
            //The focus hasn't moved ... so still on tc1
            Assert.That(tc1.Content.Rows, Has.Count.EqualTo(6));
            Assert.That(tc1.Content.Columns, Has.Count.EqualTo(5));
        }
        public void Copy_SimpleMaster_CopyIsNotReferenceCopy()
        {
            var manager = new TestCaseCollectionManager();
            var master = manager.Item("master");
            Load(master.Content, new string[] { "a11,a12", "a11,a22", "a21,a32" }, "alpha1,alpha2");

            manager.Copy("master", "copied");
            var copied = manager.Item("copied");
            manager.Item("master").Content.Clear();

            Assert.That(master.Content.Rows, Has.Count.EqualTo(0));
            Assert.That(copied.Content.Rows, Has.Count.GreaterThan(0));
        }
        public void Copy_SimpleMaster_CopyIsEffectivelyDone()
        {
            var manager = new TestCaseCollectionManager();
            var master = manager.Item("master");
            Load(master.Content, new string[] { "a11,a12", "a11,a22", "a21,a32" }, "alpha1,alpha2");

            manager.Copy("master", "copied");
            var copied = manager.Item("copied");

            for (int i = 0; i < master.Content.Rows.Count; i++)
                Assert.That(copied.Content.Rows[i].ItemArray, Is.EqualTo(master.Content.Rows[i].ItemArray));

            Assert.That(copied.Content.Rows, Has.Count.EqualTo(master.Content.Rows.Count));
        }
        public void Cross_ThreeTimesTwoOnMatchingColumnWithoutPrimaryKey_FiveRowsFourColumns()
        {
            var manager = new TestCaseCollectionManager();
            var tc1 = manager.Item("alpha");
            Load(tc1.Content, new string[] { "a11,a12", "a11,a22", "a21,a32" }, "alpha1,alpha2");
            var tc2 = manager.Item("beta");
            Load(tc2.Content, new string[] { "a11,b12,b13", "a21,b22,b23", "a21,b32,b33", "a21,b42,b43", "a41,b52,b53" }, "alpha1,beta2,beta3");

            manager.SetFocus("gamma");
            manager.Cross("alpha", "beta", "alpha1");

            var focus = manager.Scope;

            Assert.That(focus.Content.Rows, Has.Count.EqualTo(5));
            Assert.That(focus.Content.Columns, Has.Count.EqualTo(4));
        }
Exemplo n.º 7
0
        public TestCasesPresenter(RenameVariableWindow renameVariablewindow, FilterWindow filterWindow, ConnectionStringWindow connectionStringWindow, TestCaseCollectionManager testCaseCollectionManager, DataTable testCases, BindingList<string> variables, BindingList<string> connectionStringNames)
        {
            this.OpenTestCasesCommand = new OpenTestCasesCommand(this);
            this.OpenTestCasesQueryCommand = new OpenTestCasesQueryCommand(this);
            this.RenameVariableCommand = new RenameVariableCommand(this, renameVariablewindow);
            this.RemoveVariableCommand = new RemoveVariableCommand(this);
            this.MoveLeftVariableCommand = new MoveLeftVariableCommand(this);
            this.MoveRightVariableCommand = new MoveRightVariableCommand(this);
            this.FilterCommand = new FilterCommand(this, filterWindow);
            this.FilterDistinctCommand = new FilterDistinctCommand(this);
            this.AddConnectionStringCommand = new AddConnectionStringCommand(this, connectionStringWindow);
            this.RemoveConnectionStringCommand = new RemoveConnectionStringCommand(this);
            this.EditConnectionStringCommand = new EditConnectionStringCommand(this, connectionStringWindow);
            this.RunQueryCommand = new RunQueryCommand(this);

            this.testCaseCollectionManager = testCaseCollectionManager;
            TestCases = testCases;
            Variables = variables;
            ConnectionStringNames = connectionStringNames;
            ConnectionStringSelectedIndex = -1;
            VariableSelectedIndex = -1;
        }
        public void Item_NullName_DifferentElements()
        {
            var manager = new TestCaseCollectionManager();
            var tc1 = manager.Item(null);

            Assert.That(tc1, Is.Not.Null);
        }
        public void Item_GetTwoDistinct_DifferentElements()
        {
            var manager = new TestCaseCollectionManager();
            var tc1 = manager.Item("alpha");
            var tc2 = manager.Item("beta");

            Assert.That(tc1, Is.Not.EqualTo(tc2));
        }
        public void Item_GetTwice_SameElement()
        {
            var manager = new TestCaseCollectionManager();
            var tc1 = manager.Item("alpha");
            var tc2 = manager.Item("alpha");

            Assert.That(tc1, Is.EqualTo(tc2));
        }
 public void Item_EmptyCollection_ElementCreated()
 {
     var manager = new TestCaseCollectionManager();
     var tc = manager.Item("alpha");
     Assert.That(tc, Is.Not.Null);
     Assert.That(tc, Is.TypeOf<TestCaseManager>());
 }
 public void Item_EmptyCollectionWithNoName_ElementCreated()
 {
     var manager = new TestCaseCollectionManager();
     var tc = manager.Item(string.Empty);
     Assert.That(tc, Is.Not.Null);
     Assert.That(tc, Is.TypeOf<TestCaseManager>());
 }
        public void Focus_TwoElementsCreatedSetFocusNeverCalled_FirstElement()
        {
            var manager = new TestCaseCollectionManager();
            var tc1 = manager.Item("alpha");
            var tc2 = manager.Item("beta");

            var focus = manager.Scope;

            Assert.That(focus, Is.EqualTo(tc1));
        }
        public void Focus_TwoElementsCreatedSetFocusCalledForSecond_SecondElement()
        {
            var manager = new TestCaseCollectionManager();
            var tc1 = manager.Item("alpha");
            var tc2 = manager.Item("beta");

            manager.SetFocus("beta");
            var focus = manager.Scope;

            Assert.That(focus, Is.EqualTo(tc2));
        }
        public void Cross_ThreeTimesTwo_SixRowsFiveColumns()
        {
            var manager = new TestCaseCollectionManager();
            var tc1 = manager.Item("alpha");
            Load(tc1.Content, new string[] { "a11,a12", "a21,a22", "a31,a32" }, "alpha1,alpha2");
            var tc2 = manager.Item("beta");
            Load(tc2.Content, new string[] { "b11,b12,b13", "b21,b22,b23" }, "beta1,beta2,beta3");

            manager.SetFocus("gamma");
            manager.Cross("alpha", "beta");

            var focus = manager.Scope;

            Assert.That(focus.Content.Rows, Has.Count.EqualTo(6));
            Assert.That(focus.Content.Columns, Has.Count.EqualTo(5));
        }