public void SetUpFixture()
        {
            WixDocument doc = new WixDocument();

            doc.LoadXml(GetWixXml());

            WixDialog wixDialog = doc.CreateWixDialog("WelcomeDialog", new MockTextFileReader());

            using (Form dialog = wixDialog.CreateDialog()) {
                GroupBox groupBox = new GroupBox();
                groupBox.Name = "NewGroupBox";
                groupBox.Top  = 10;
                groupBox.Left = 20;
                dialog.Controls.Add(groupBox);

                TextBox textBox = new TextBox();
                textBox.Name = "NewTextBox";
                groupBox.Controls.Add(textBox);

                Button button = new Button();
                button.Name = "NewButton";
                groupBox.Controls.Add(button);

                GroupBox childGroupBox = new GroupBox();
                childGroupBox.Top  = 10;
                childGroupBox.Left = 20;
                childGroupBox.Name = "NewChildGroupBox";
                groupBox.Controls.Add(childGroupBox);

                RadioButtonGroupBox radioButtonGroupBox = new RadioButtonGroupBox();
                radioButtonGroupBox.Name = "NewRadioButtonGroupBox";
                groupBox.Controls.Add(radioButtonGroupBox);

                Button childButton = new Button();
                childButton.Name = "NewChildButton";
                childGroupBox.Controls.Add(childButton);

                dialogElement           = wixDialog.UpdateDialogElement(dialog);
                groupBoxElement         = (XmlElement)dialogElement.SelectSingleNode("w:Control[@Id='NewGroupBox']", new WixNamespaceManager(dialogElement.OwnerDocument.NameTable));
                textBoxElement          = (XmlElement)dialogElement.SelectSingleNode("w:Control[@Id='NewTextBox']", new WixNamespaceManager(dialogElement.OwnerDocument.NameTable));
                childGroupBoxElement    = (XmlElement)dialogElement.SelectSingleNode("w:Control[@Id='NewChildGroupBox']", new WixNamespaceManager(dialogElement.OwnerDocument.NameTable));
                buttonElement           = (XmlElement)dialogElement.SelectSingleNode("w:Control[@Id='NewButton']", new WixNamespaceManager(dialogElement.OwnerDocument.NameTable));
                radioButtonGroupElement = (XmlElement)dialogElement.SelectSingleNode("w:Control[@Id='NewRadioButtonGroupBox']", new WixNamespaceManager(dialogElement.OwnerDocument.NameTable));
                childButtonElement      = (XmlElement)dialogElement.SelectSingleNode("w:Control[@Id='NewChildButton']", new WixNamespaceManager(dialogElement.OwnerDocument.NameTable));
            }
        }
        public void SetUpFixture()
        {
            SD.InitializeForUnitTests();

            BitmapFileNamesRequested.Clear();
            CreatedComponents.Clear();
            WixProject  project = WixBindingTestsHelper.CreateEmptyWixProject();
            WixDocument doc     = new WixDocument(project, this);

            doc.LoadXml(GetWixXml());
            WixDialog wixDialog = doc.CreateWixDialog("WelcomeDialog", new MockTextFileReader());

            using (Form dialog = wixDialog.CreateDialog(this)) {
                PictureBox pictureBox = (PictureBox)dialog.Controls[0];
                hasImage = (pictureBox.Image != null);
                sizeMode = pictureBox.SizeMode;
            }
        }
Exemple #3
0
        public void SetUpFixture()
        {
            CreatedComponents.Clear();
            WixDocument doc = new WixDocument();

            doc.LoadXml(GetWixXml());
            WixDialog wixDialog = doc.GetDialog("WelcomeDialog");

            using (Form dialog = wixDialog.CreateDialog(this)) {
                Label label = (Label)dialog.Controls[0];
                labelName     = label.Name;
                labelText     = label.Text;
                labelLocation = label.Location;
                labelSize     = label.Size;
                labelFontName = label.Font.Name;
                labelFontSize = label.Font.Size;
                labelFontBold = label.Font.Bold;
            }
        }
Exemple #4
0
        public void SetUpFixture()
        {
            WixDocument doc = new WixDocument();

            doc.LoadXml(GetWixXml());
            WixDialog wixDialog = doc.GetDialog("WelcomeDialog");

            using (Form dialog = wixDialog.CreateDialog(this)) {
                Label titleLabel = (Label)dialog.Controls[0];
                titleLabelFontName = titleLabel.Font.Name;
                titleLabelFontSize = titleLabel.Font.Size;
                titleLabelFontBold = titleLabel.Font.Bold;

                Label descLabel = (Label)dialog.Controls[1];
                descLabelFontName = descLabel.Font.Name;
                descLabelFontSize = descLabel.Font.Size;
                descLabelFontBold = descLabel.Font.Bold;
            }
        }
Exemple #5
0
        public void SetUpFixture()
        {
            WixDocument doc = new WixDocument();

            doc.LoadXml(GetWixXml());
            CreatedComponents.Clear();
            WixDialog wixDialog = doc.CreateWixDialog("AcceptLicenseDialog", new MockTextFileReader());

            using (Form dialog = wixDialog.CreateDialog(this)) {
                RadioButtonGroupBox radioButtonGroup = new RadioButtonGroupBox();
                radioButtonGroup.Left         = 30;
                radioButtonGroup.Top          = 100;
                radioButtonGroup.Name         = "AcceptLicenseRadioButtonGroup";
                radioButtonGroup.PropertyName = "AcceptLicense";
                dialog.Controls.Add(radioButtonGroup);

                RadioButton acceptRadioButton = new RadioButton();
                acceptRadioButton.Left   = 0;
                acceptRadioButton.Top    = 5;
                acceptRadioButton.Width  = 100;
                acceptRadioButton.Height = 50;
                acceptRadioButton.Text   = "Accept";
                acceptRadioButton.Name   = "AcceptLicenseRadioButton1";
                radioButtonGroup.Controls.Add(acceptRadioButton);

                RadioButton declineRadioButton = new RadioButton();
                declineRadioButton.Left   = 10;
                declineRadioButton.Top    = 20;
                declineRadioButton.Width  = 200;
                declineRadioButton.Height = 30;
                declineRadioButton.Text   = "Decline";
                declineRadioButton.Name   = "AcceptLicenseRadioButton2";
                radioButtonGroup.Controls.Add(declineRadioButton);

                XmlElement dialogElement = wixDialog.UpdateDialogElement(dialog);
                controlElement          = (XmlElement)dialogElement.SelectSingleNode("w:Control[@Id='AcceptLicenseRadioButtonGroup']", new WixNamespaceManager(dialogElement.OwnerDocument.NameTable));
                radioButtonGroupElement = (XmlElement)dialogElement.SelectSingleNode("//w:RadioButtonGroup[@Property='AcceptLicense']", new WixNamespaceManager(dialogElement.OwnerDocument.NameTable));
                XmlNodeList radioButtonElements = radioButtonGroupElement.SelectNodes("//w:RadioButtonGroup/w:RadioButton", new WixNamespaceManager(dialogElement.OwnerDocument.NameTable));
                acceptRadioButtonElement  = (XmlElement)radioButtonElements[0];
                declineRadioButtonElement = (XmlElement)radioButtonElements[1];
            }
        }
        public void SetUpFixture()
        {
            CreatedComponents.Clear();
            WixDocument doc = new WixDocument();

            doc.LoadXml(GetWixXml());
            WixDialog wixDialog = doc.GetDialog("WelcomeDialog");

            using (Form dialog = wixDialog.CreateDialog(this)) {
                ListBox listBox = (ListBox)dialog.Controls[0];
                name     = listBox.Name;
                location = listBox.Location;
                size     = listBox.Size;

                // List items.
                listItemCount = listBox.Items.Count;
                listItem1Text = (string)listBox.Items[0];
                listItem2Text = (string)listBox.Items[1];
            }
        }
        public void SetUpFixture()
        {
            WixDocument doc = new WixDocument();

            doc.LoadXml(GetWixXml());
            CreatedComponents.Clear();
            WixDialog wixDialog = doc.CreateWixDialog("WelcomeDialog", new MockTextFileReader());

            using (Form dialog = wixDialog.CreateDialog(this)) {
                ListBox listBox = (ListBox)dialog.Controls[0];
                listBox.Items.RemoveAt(0);

                XmlElement dialogElement  = wixDialog.UpdateDialogElement(dialog);
                XmlElement listBoxElement = (XmlElement)dialogElement.SelectSingleNode("//w:ListBox[@Property='ListBoxProperty']", new WixNamespaceManager(dialogElement.OwnerDocument.NameTable));
                listBoxItemCount = listBoxElement.ChildNodes.Count;

                XmlElement listBoxItem1Element = (XmlElement)listBoxElement.ChildNodes[0];
                listBoxItem1Text = listBoxItem1Element.GetAttribute("Text");
            }
        }
Exemple #8
0
        public void SetUpFixture()
        {
            WixDocument doc = new WixDocument();

            doc.LoadXml(GetWixXml());

            WixDialog wixDialog = doc.CreateWixDialog("WelcomeDialog", new MockTextFileReader());

            using (Form dialog = wixDialog.CreateDialog()) {
                Button nextButton = (Button)dialog.Controls[0];
                dialog.AcceptButton = nextButton;

                Button cancelButton = (Button)dialog.Controls[1];
                dialog.CancelButton = cancelButton;

                dialogElement       = wixDialog.UpdateDialogElement(dialog);
                nextButtonElement   = (XmlElement)dialogElement.SelectSingleNode("w:Control[@Id='Next']", new WixNamespaceManager(dialogElement.OwnerDocument.NameTable));
                cancelButtonElement = (XmlElement)dialogElement.SelectSingleNode("w:Control[@Id='Cancel']", new WixNamespaceManager(dialogElement.OwnerDocument.NameTable));
            }
        }
Exemple #9
0
        public void SetUpFixture()
        {
            WixDocument doc = new WixDocument();

            doc.LoadXml(GetWixXml());
            CreatedComponents.Clear();
            WixDialog wixDialog = doc.CreateWixDialog("AcceptLicenseDialog", new MockTextFileReader());

            using (Form dialog = wixDialog.CreateDialog(this)) {
                Panel       radioButtonGroup = (Panel)dialog.Controls[0];
                RadioButton radioButton      = (RadioButton)radioButtonGroup.Controls[0];
                radioButtonGroup.Controls.Remove(radioButton);
                radioButton = (RadioButton)radioButtonGroup.Controls[0];
                radioButtonGroup.Controls.Remove(radioButton);

                XmlElement dialogElement = wixDialog.UpdateDialogElement(dialog);
                radioButtonElementCount = dialogElement.SelectNodes("//w:RadioButtonGroup/w:RadioButton", new WixNamespaceManager(dialogElement.OwnerDocument.NameTable)).Count;

                radioButtonElement = (XmlElement)dialogElement.SelectSingleNode("//w:RadioButtonGroup/w:RadioButton", new WixNamespaceManager(dialogElement.OwnerDocument.NameTable));
            }
        }
Exemple #10
0
        public void SetUpFixture()
        {
            CreatedComponents.Clear();
            WixDocument doc = new WixDocument();

            doc.LoadXml(GetWixXml());
            WixDialog wixDialog = doc.GetDialog("WelcomeDialog");

            using (Form dialog = wixDialog.CreateDialog(this)) {
                ComboBox comboBox = (ComboBox)dialog.Controls[0];
                name     = comboBox.Name;
                text     = comboBox.Text;
                location = comboBox.Location;
                size     = comboBox.Size;

                // Combo box items.
                itemCount = comboBox.Items.Count;
                item1Text = (string)comboBox.Items[0];
                item2Text = (string)comboBox.Items[1];
            }
        }
Exemple #11
0
        public void SetUpFixture()
        {
            BitmapFileNamesRequested.Clear();
            WixProject  project = WixBindingTestsHelper.CreateEmptyWixProject();
            WixDocument doc     = new WixDocument(project, this);

            doc.LoadXml(GetWixXml());
            WixDialog wixDialog = doc.CreateWixDialog("WelcomeDialog", new MockTextFileReader());

            using (Form dialog = wixDialog.CreateDialog(this)) {
                // Should be the last control added to the dialog appears behind all
                // the other controls. This is what happens when you call SendToBack
                // on a control.
                PictureBox pictureBox = (PictureBox)dialog.Controls[dialog.Controls.Count - 1];
                name     = pictureBox.Name;
                text     = pictureBox.Text;
                location = pictureBox.Location;
                size     = pictureBox.Size;
                hasImage = (pictureBox.Image != null);
            }
        }
Exemple #12
0
        public void SetUpFixture()
        {
            CreatedComponents.Clear();
            WixDocument doc = new WixDocument();

            doc.LoadXml(GetWixXml());
            WixDialog wixDialog = doc.CreateWixDialog("WelcomeDialog", new MockTextFileReader());

            using (Form dialog = wixDialog.CreateDialog(this)) {
                ListView listView = (ListView)dialog.Controls[0];
                name     = listView.Name;
                location = listView.Location;
                size     = listView.Size;
                view     = listView.View;

                // List items.
                listItemCount = listView.Items.Count;
                listItem1Text = listView.Items[0].Text;
                listItem2Text = listView.Items[1].Text;
            }
        }
        public void SetUpFixture()
        {
            WixDocument doc = new WixDocument();

            doc.LoadXml(GetWixXml());

            WixDialog wixDialog = doc.GetDialog("WelcomeDialog");

            using (Form dialog = wixDialog.CreateDialog()) {
                Button nextButton = new Button();
                nextButton.Left   = 200;
                nextButton.Top    = 220;
                nextButton.Width  = 50;
                nextButton.Height = 10;
                nextButton.Text   = "[Button_Next]";
                nextButton.Name   = "Next";
                dialog.Controls.Add(nextButton);

                dialogElement     = wixDialog.UpdateDialogElement(dialog);
                nextButtonElement = (XmlElement)dialogElement.SelectSingleNode("w:Control[@Id='Next']", new WixNamespaceManager(dialogElement.OwnerDocument.NameTable));
            }
        }
        public void SetUpFixture()
        {
            WixDocument doc = new WixDocument();

            doc.LoadXml(GetWixXml());
            CreatedComponents.Clear();
            WixDialog wixDialog = doc.GetDialog("WelcomeDialog");

            using (Form dialog = wixDialog.CreateDialog(this)) {
                ComboBox comboBox = (ComboBox)dialog.Controls[0];
                comboBox.Items.Add("New item1");
                comboBox.Items.Add("New item2");

                XmlElement dialogElement   = wixDialog.UpdateDialogElement(dialog);
                XmlElement comboBoxElement = (XmlElement)dialogElement.SelectSingleNode("//w:ComboBox[@Property='ComboBoxProperty']", new WixNamespaceManager(dialogElement.OwnerDocument.NameTable));

                itemCount = comboBoxElement.ChildNodes.Count;
                XmlElement item1Element = (XmlElement)comboBoxElement.ChildNodes[0];
                item1Text = item1Element.GetAttribute("Text");
                XmlElement item2Element = (XmlElement)comboBoxElement.ChildNodes[1];
                item2Text = item2Element.GetAttribute("Text");
            }
        }
Exemple #15
0
        public void MissingWidth()
        {
            WixProject  project = WixBindingTestsHelper.CreateEmptyWixProject();
            WixDocument doc     = new WixDocument(project);
            string      xml     = "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>\r\n" +
                                  "\t<Fragment>\r\n" +
                                  "\t\t<UI>\r\n" +
                                  "\t\t\t<Dialog Id='WelcomeDialog' Height='370'/>\r\n" +
                                  "\t\t</UI>\r\n" +
                                  "\t</Fragment>\r\n" +
                                  "</Wix>";

            doc.LoadXml(xml);
            WixDialog wixDialog = doc.GetDialog("WelcomeDialog");

            try {
                wixDialog.CreateDialog();
                Assert.Fail("Expected an exception before this line.");
            } catch (WixDialogException ex) {
                Assert.AreEqual("Dialog", ex.ElementName);
                Assert.AreEqual("WelcomeDialog", ex.Id);
                Assert.AreEqual("Required attribute 'Width' is missing.", ex.Message);
            }
        }
Exemple #16
0
        public void InvalidHeight()
        {
            WixProject  project = WixBindingTestsHelper.CreateEmptyWixProject();
            WixDocument doc     = new WixDocument(project);
            string      xml     = "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>\r\n" +
                                  "\t<Fragment>\r\n" +
                                  "\t\t<UI>\r\n" +
                                  "\t\t\t<Dialog Id='WelcomeDialog' Height='f' Width='370'/>\r\n" +
                                  "\t\t</UI>\r\n" +
                                  "\t</Fragment>\r\n" +
                                  "</Wix>";

            doc.LoadXml(xml);
            WixDialog wixDialog = doc.CreateWixDialog("WelcomeDialog", new MockTextFileReader());

            try {
                wixDialog.CreateDialog();
                Assert.Fail("Expected an exception before this line.");
            } catch (WixDialogException ex) {
                Assert.AreEqual("Dialog", ex.ElementName);
                Assert.AreEqual("WelcomeDialog", ex.Id);
                Assert.AreEqual("The Height attribute's value, 'f', is not a legal integer value.", ex.Message);
            }
        }
Exemple #17
0
        public void SetUpFixture()
        {
            WixDocument doc = new WixDocument();

            doc.LoadXml(GetWixXml());
            controlsAddedCount = 0;
            CreatedComponents.Clear();
            WixDialog wixDialog = doc.GetDialog("AcceptLicenseDialog");

            using (Form dialog = wixDialog.CreateDialog(this)) {
                foreach (Control control in dialog.Controls)
                {
                    ++controlsAddedCount;
                }

                Panel radioButtonGroup = (Panel)dialog.Controls[0];
                radioButtonGroupName = radioButtonGroup.Name;

                foreach (Control child in radioButtonGroup.Controls)
                {
                    ++radioButtonGroupChildControlsAdded;
                }
            }
        }