示例#1
0
        protected override void OnShown(AllorsEventOccuredEventArgs args)
        {
            switch (this.testCaseSwitch)
            {
            case TestCaseSwitch.Create:
                switch (++this.OnShownCount)
                {
                case 1:
                    this.MinimalWizard();
                    break;

                case 2:
                    var folderBrowserDialogTester = new FolderBrowserDialogTester(args.Tester);
                    folderBrowserDialogTester.Target.DialogResult = DialogResult.OK;
                    folderBrowserDialogTester.Target.SelectedPath = RepositoryDirectory.FullName;
                    break;

                default:
                    throw new Exception("No event handler for Onshown");
                }

                break;

            default:
                throw new Exception("No event handler for Onshown");
            }
        }
示例#2
0
        public void BooleanIllegal_OnShown2(AllorsEventOccuredEventArgs args)
        {
            MessageBoxTester messageBoxTester = new MessageBoxTester(args.Tester);

            messageBoxTester.Target.DialogResult = DialogResult.OK;
            this.messageBoxText = messageBoxTester.Target.Text;
        }
示例#3
0
        public void NameAlreadyExists_OnShown2(AllorsEventOccuredEventArgs args)
        {
            MessageBoxTester messageBoxTester = new MessageBoxTester(args.Tester);

            messageBoxTester.Target.DialogResult = DialogResult.OK;
            this.messageBoxText = messageBoxTester.Target.Text;
        }
        protected override void OnShown(AllorsEventOccuredEventArgs args)
        {
            switch (testCaseSwitch)
            {
            case TestCaseSwitch.Minimal:
                Minimal_Wizard(args);
                break;

            case TestCaseSwitch.Maximal:
                Maximal_Wizard(args);
                break;

            case TestCaseSwitch.NoName:
                switch (onShownCount++)
                {
                case 0:
                    NoName_Wizard(args);
                    break;

                case 1:
                    MessageBoxTester messageBoxTester = new MessageBoxTester(args.Tester);
                    messageBoxTester.Target.DialogResult = DialogResult.OK;
                    Assert.AreEqual("Domain has no name", messageBoxTester.Target.Text);
                    break;

                case 2:
                    NoName_Wizard2(args);
                    break;

                default:
                    throw new Exception("No event handler for Onshown");
                }
                break;

            case TestCaseSwitch.IncorrectName:
                switch (onShownCount++)
                {
                case 0:
                    IncorrectName_Wizard(args);
                    break;

                case 1:
                    MessageBoxTester messageBoxTester = new MessageBoxTester(args.Tester);
                    messageBoxTester.Target.DialogResult = DialogResult.OK;
                    Assert.AreEqual("Domain A_Name_With_Underscores should only contain alfanumerical characters)", messageBoxTester.Target.Text);
                    break;

                case 2:
                    IncorrectName_Wizard2(args);
                    break;

                default:
                    throw new Exception("No event handler for Onshown");
                }
                break;

            default:
                throw new Exception("No event handler for Onshown");
            }
        }
示例#5
0
        public void MetaObjectNotFound_OnShown2(AllorsEventOccuredEventArgs args)
        {
            MessageBoxTester messageBoxTester = new MessageBoxTester(args.Tester);

            messageBoxTester.Target.DialogResult = DialogResult.OK;
            this.messageBoxText = messageBoxTester.Target.Text;
        }
示例#6
0
        public void StringCancel_OnShown1(AllorsEventOccuredEventArgs args)
        {
            nameTextBox.Target.Text  = "MyExtension";
            valueTextBox.Target.Text = "MyValue";

            cancelButtonTester.Click();
        }
示例#7
0
        public void CompositeCancel_OnShown1(AllorsEventOccuredEventArgs args)
        {
            compositeRadioButton.Target.Checked = true;

            nameTextBox.Target.Text = "MyExtension";

            cancelButtonTester.Click();
        }
        private void IncorrectName_Wizard(AllorsEventOccuredEventArgs args)
        {
            TextBoxTester nameTextBoxTester = new TextBoxTester(Constants.DOMAIN_WIZARD, Constants.NAME_TEXT_BOX);

            nameTextBoxTester.Target.Text = "A_Name_With_Underscores";

            ButtonTester finishButtonTester = new ButtonTester(Constants.DOMAIN_WIZARD, Constants.FINISH_BUTTON);

            finishButtonTester.Click();
        }
        private void Minimal_Wizard(AllorsEventOccuredEventArgs args)
        {
            TextBoxTester nameTextBoxTester = new TextBoxTester(Constants.DOMAIN_WIZARD, Constants.NAME_TEXT_BOX);

            nameTextBoxTester.Target.Text = "MyDomain";

            ButtonTester finishButtonTester = new ButtonTester(Constants.DOMAIN_WIZARD, Constants.FINISH_BUTTON);

            finishButtonTester.Click();
        }
示例#10
0
        public void StringNoName_OnShown1(AllorsEventOccuredEventArgs args)
        {
            valueTextBox.Target.Text = "MyValue";

            Assert.IsNull(messageBoxText);

            finishButtonTester.Click();

            Assert.AreEqual("Name is required", messageBoxText);

            cancelButtonTester.Click();
        }
示例#11
0
        public void StringEmpty_OnShown1(AllorsEventOccuredEventArgs args)
        {
            nameTextBox.Target.Text = "MyExtension";

            Assert.IsNull(messageBoxText);

            finishButtonTester.Click();

            Assert.IsNull(messageBoxText);

            finishButtonTester.Click();
        }
示例#12
0
        public void NameAlreadyExists_OnShown1(AllorsEventOccuredEventArgs args)
        {
            nameTextBox.Target.Text  = "Same";
            valueTextBox.Target.Text = "Different";

            Assert.IsNull(messageBoxText);

            finishButtonTester.Click();

            Assert.AreEqual("Extension with name Same already exists", messageBoxText);

            cancelButtonTester.Click();
        }
示例#13
0
        protected override void OnShown(AllorsEventOccuredEventArgs args)
        {
            string     methodName = testCaseSwitch + "_OnShown" + ++onShownCount;
            MethodInfo method     = this.GetType().GetMethod(methodName);

            if (method == null)
            {
                throw new Exception("No event handler for " + methodName);
            }

            object[] methodArgs = { args };
            method.Invoke(this, methodArgs);
        }
        private void TestAllorsEventOccured(object sender, AllorsEventOccuredEventArgs args)
        {
            switch (args.EventKind)
            {
            case AllorsEventKind.Shown:
                this.OnShown(args);
                break;

            case AllorsEventKind.CheckedChanged:
                this.OnCheckedChanged(args);
                break;
            }
        }
示例#15
0
        public void BooleanIllegal_OnShown1(AllorsEventOccuredEventArgs args)
        {
            typeComboBox.Target.SelectedItem = UnitTypeTag.AllorsBoolean;

            nameTextBox.Target.Text  = "MyExtension";
            valueTextBox.Target.Text = "Oops";

            Assert.IsNull(messageBoxText);

            finishButtonTester.Click();

            Assert.AreEqual("The string 'Oops' is not a valid Boolean value.", messageBoxText);

            cancelButtonTester.Click();
        }
        protected override void OnShown(AllorsEventOccuredEventArgs args)
        {
            switch (this.testCaseSwitch)
            {
            case TestCaseSwitch.Extension:
                ExtensionEditor();
                break;

            case TestCaseSwitch.Interfaces:
                InterfacesEditor();
                break;

            default:
                throw new Exception("No event handler for Onshown");
            }
        }
        protected override void OnShown(AllorsEventOccuredEventArgs args)
        {
            switch (this.testCaseSwitch)
            {
            case TestCaseSwitch.Minimal:
                this.MinimalWizard();
                break;

            case TestCaseSwitch.Maximal:
                this.MaximalWizard();
                break;

            default:
                throw new Exception("No event handler for Onshown");
            }
        }
示例#18
0
        public void Composite_OnShown1(AllorsEventOccuredEventArgs args)
        {
            compositeRadioButton.Target.Checked = true;

            nameTextBox.Target.Text = "MyExtension";

            Assert.IsFalse(valueTextBox.Target.Enabled);
            Assert.IsFalse(typeComboBox.Target.Enabled);
            Assert.IsFalse(idTextBox.Target.Enabled);

            Assert.IsFalse(unitRadioButton.Target.Checked);
            Assert.IsTrue(compositeRadioButton.Target.Checked);
            Assert.IsFalse(metaObjectRadioButton.Target.Checked);

            finishButtonTester.Click();
        }
示例#19
0
        public void Boolean_OnShown1(AllorsEventOccuredEventArgs args)
        {
            typeComboBox.Target.SelectedItem = UnitTypeTag.AllorsBoolean;

            nameTextBox.Target.Text  = "MyExtension";
            valueTextBox.Target.Text = "true";

            Assert.IsTrue(valueTextBox.Target.Enabled);
            Assert.IsTrue(typeComboBox.Target.Enabled);
            Assert.AreEqual("Boolean", typeComboBox.Target.Text);
            Assert.IsFalse(idTextBox.Target.Enabled);

            Assert.IsTrue(unitRadioButton.Target.Checked);
            Assert.IsFalse(compositeRadioButton.Target.Checked);
            Assert.IsFalse(metaObjectRadioButton.Target.Checked);

            finishButtonTester.Click();
        }
示例#20
0
        public void MetaObjectWithoutId_OnShown1(AllorsEventOccuredEventArgs args)
        {
            metaObjectRadioButton.Target.Checked = true;

            nameTextBox.Target.Text = "MyExtension";

            Assert.IsFalse(valueTextBox.Target.Enabled);
            Assert.IsFalse(typeComboBox.Target.Enabled);
            Assert.IsTrue(idTextBox.Target.Enabled);

            Assert.IsFalse(unitRadioButton.Target.Checked);
            Assert.IsFalse(compositeRadioButton.Target.Checked);
            Assert.IsTrue(metaObjectRadioButton.Target.Checked);

            Assert.IsNull(messageBoxText);

            finishButtonTester.Click();

            Assert.IsNotNull(messageBoxText);
            Assert.AreEqual("Id is required", messageBoxText);

            cancelButtonTester.Click();
        }
示例#21
0
        public void MetaObjectNotFound_OnShown1(AllorsEventOccuredEventArgs args)
        {
            metaObjectRadioButton.Target.Checked = true;

            nameTextBox.Target.Text = "MyExtension";
            idTextBox.Target.Text   = Guid.NewGuid().ToString();

            Assert.IsFalse(valueTextBox.Target.Enabled);
            Assert.IsFalse(typeComboBox.Target.Enabled);
            Assert.IsTrue(idTextBox.Target.Enabled);

            Assert.IsFalse(unitRadioButton.Target.Checked);
            Assert.IsFalse(compositeRadioButton.Target.Checked);
            Assert.IsTrue(metaObjectRadioButton.Target.Checked);

            Assert.IsNull(messageBoxText);

            finishButtonTester.Click();

            Assert.IsNotNull(messageBoxText);
            Assert.AreEqual("Meta object with id " + idTextBox.Target.Text + " does not exist.", messageBoxText);

            cancelButtonTester.Click();
        }
示例#22
0
        protected override void OnShown(AllorsEventOccuredEventArgs args)
        {
            switch (this.testCaseSwitch)
            {
            case TestCaseSwitch.Minimal:
                switch (++this.OnShownCount)
                {
                case 1:
                    this.MinimalWizard();
                    break;

                default:
                    throw new Exception("No event handler for Onshown");
                }

                break;

            case TestCaseSwitch.MissingTemplate:
                switch (++this.OnShownCount)
                {
                case 1:
                    this.MissingTemplate_Wizard();
                    break;

                case 2:
                    var messageBoxTester = new MessageBoxTester(args.Tester);
                    messageBoxTester.Target.DialogResult = DialogResult.OK;
                    Assert.AreEqual("Template Source is not valid.", messageBoxTester.Target.Text);
                    break;

                default:
                    throw new Exception("No event handler for Onshown");
                }

                break;

            case TestCaseSwitch.IllegalTemplate:
                switch (++this.OnShownCount)
                {
                case 1:
                    this.IllegalTemplateWizard();
                    break;

                case 2:
                case 3:
                case 4:
                case 5:
                case 6:
                    var messageBoxTester = new MessageBoxTester(args.Tester);
                    messageBoxTester.Target.DialogResult = DialogResult.OK;
                    Assert.AreEqual("Template Source is not valid.", messageBoxTester.Target.Text);
                    break;

                default:
                    throw new Exception("No event handler for Onshown");
                }

                break;

            default:
                throw new Exception("No event handler for Onshown");
            }
        }
示例#23
0
        protected override void OnShown(AllorsEventOccuredEventArgs args)
        {
            switch (this.testCaseSwitch)
            {
            case TestCaseSwitch.OpenRepository:
                switch (++this.OnShownCount)
                {
                case 1:
                    var openFileDialogTester = new OpenFileDialogTester(args.Tester);
                    openFileDialogTester.Target.DialogResult = DialogResult.OK;
                    openFileDialogTester.Target.FileName     = RepositoryFile.FullName;
                    break;

                default:
                    throw new Exception("No event handler for Onshown");
                }

                break;

            case TestCaseSwitch.AddSuperDomain:
                switch (++this.OnShownCount)
                {
                case 1:
                    var openFileDialogTester = new OpenFileDialogTester(args.Tester);
                    openFileDialogTester.Target.DialogResult = DialogResult.OK;
                    openFileDialogTester.Target.FileName     = this.SuperDomainRepositoryFileInfo.FullName;
                    break;

                default:
                    throw new Exception("No event handler for Onshown");
                }

                break;

            case TestCaseSwitch.DeleteType:
                switch (++this.OnShownCount)
                {
                case 1:
                    var messageBoxTester = new MessageBoxTester(args.Tester);
                    messageBoxTester.Target.DialogResult = DialogResult.OK;
                    Assert.AreEqual("Do you really want to delete Singular and all its relations?", messageBoxTester.Target.Text);
                    break;

                default:
                    throw new Exception("No event handler for Onshown");
                }

                break;

            case TestCaseSwitch.DeleteTypeWithCascading:
                switch (++this.OnShownCount)
                {
                case 1:
                    var deleteMessageBoxTester = new MessageBoxTester(args.Tester);
                    deleteMessageBoxTester.Target.DialogResult = DialogResult.OK;
                    Assert.AreEqual("Do you really want to delete Singular and all its relations?", deleteMessageBoxTester.Target.Text);
                    break;

                default:
                    throw new Exception("No event handler for Onshown");
                }

                break;

            case TestCaseSwitch.DeleteRelation:
                switch (++this.OnShownCount)
                {
                case 1:
                    var messageBoxTester = new MessageBoxTester(args.Tester);
                    messageBoxTester.Target.DialogResult = DialogResult.OK;
                    Assert.AreEqual("Do you really want to delete Singular.AllorsString?", messageBoxTester.Target.Text);
                    break;

                default:
                    throw new Exception("No event handler for Onshown");
                }

                break;

            case TestCaseSwitch.DeleteSuperDomain:
                switch (++this.OnShownCount)
                {
                case 1:
                    var messageBoxTester = new MessageBoxTester(args.Tester);
                    messageBoxTester.Target.DialogResult = DialogResult.OK;
                    Assert.AreEqual("Do you really want to delete SuperDomain?", messageBoxTester.Target.Text);
                    break;

                default:
                    throw new Exception("No event handler for Onshown");
                }

                break;

            case TestCaseSwitch.UpdateTemplate:
                switch (++this.OnShownCount)
                {
                case 1:
                    var messageBoxTester = new MessageBoxTester(args.Tester);
                    messageBoxTester.Target.DialogResult = DialogResult.OK;
                    Assert.AreEqual("Could not update template\n\nTemplate Url can not be null.", messageBoxTester.Target.Text);
                    break;

                case 2:
                    messageBoxTester = new MessageBoxTester(args.Tester);
                    messageBoxTester.Target.DialogResult = DialogResult.OK;
                    Assert.IsTrue(messageBoxTester.Target.Text.StartsWith("Could not update template\n\nMissing property TemplateName"));
                    break;

                case 3:
                    messageBoxTester = new MessageBoxTester(args.Tester);
                    messageBoxTester.Target.DialogResult = DialogResult.OK;
                    Assert.IsTrue(messageBoxTester.Target.Text.StartsWith("Could not update template"));
                    break;

                default:
                    throw new Exception("No event handler for Onshown");
                }

                break;

            case TestCaseSwitch.Generate:
                switch (++this.OnShownCount)
                {
                case 1:
                    var messageBoxTester = new MessageBoxTester(args.Tester);
                    messageBoxTester.Target.DialogResult = DialogResult.OK;
                    Assert.AreEqual("No templates defined.", messageBoxTester.Target.Text);
                    break;

                default:
                    throw new Exception("No event handler for Onshown");
                }

                break;

            default:
                throw new Exception("No event handler for Onshown");
            }
        }
        private void IncorrectName_Wizard2(AllorsEventOccuredEventArgs args)
        {
            ButtonTester cancelButtonTester = new ButtonTester(Constants.DOMAIN_WIZARD, Constants.CANCEL_BUTTON);

            cancelButtonTester.Click();
        }
 protected virtual void OnCheckedChanged(AllorsEventOccuredEventArgs args)
 {
 }
 protected virtual void OnShown(AllorsEventOccuredEventArgs args)
 {
 }
        protected override void OnShown(AllorsEventOccuredEventArgs args)
        {
            switch (this.testCaseSwitch)
            {
            case TestCaseSwitch.Minimal:
                this.MinimalWizard();
                break;

            case TestCaseSwitch.Maximal:
                this.MaximalWizard();
                break;

            case TestCaseSwitch.NoSingularName:
                switch (++this.OnShownCount)
                {
                case 1:
                    this.NoSingularName_Wizard();
                    break;

                case 2:
                    var messageBoxTester = new MessageBoxTester(args.Tester);
                    messageBoxTester.Target.DialogResult = DialogResult.OK;
                    Assert.IsTrue(messageBoxTester.Target.Text.StartsWith("object type"));
                    Assert.IsTrue(messageBoxTester.Target.Text.EndsWith("has no singular name"));
                    break;

                default:
                    throw new Exception("No event handler for Onshown");
                }

                break;

            case TestCaseSwitch.NoPluralName:
                switch (++this.OnShownCount)
                {
                case 1:
                    this.NoPluralNameWizard();
                    break;

                case 2:
                    var messageBoxTester = new MessageBoxTester(args.Tester);
                    messageBoxTester.Target.DialogResult = DialogResult.OK;
                    Assert.IsTrue(messageBoxTester.Target.Text.StartsWith("object type"));
                    Assert.IsTrue(messageBoxTester.Target.Text.EndsWith("has no plural name"));
                    break;

                default:
                    throw new Exception("No event handler for Onshown");
                }

                break;

            case TestCaseSwitch.IncorrectSingularName:
                switch (++this.OnShownCount)
                {
                case 1:
                    this.IncorrectSingularNameWizard();
                    break;

                case 2:
                    var messageBoxTester = new MessageBoxTester(args.Tester);
                    messageBoxTester.Target.DialogResult = DialogResult.OK;
                    Assert.AreEqual("object type My_Type's singular name should only contain alfanumerical characters", messageBoxTester.Target.Text);
                    break;

                default:
                    throw new Exception("No event handler for Onshown");
                }

                break;

            default:
                throw new Exception("No event handler for Onshown");
            }
        }