Inheritance: IPopupController
Ejemplo n.º 1
0
        public void PopupController_ShowDeleteConfirmation_SetProperties_AllPropertiesDisplayed()
        {
            //------------Setup for test--------------------------
            var popupWasCalled = false;
            string description = string.Empty;
            string header = string.Empty;
            MessageBoxButton buttons = MessageBoxButton.YesNoCancel;

            var popupController = new PopupController
                {
                    ShowDev2MessageBox = (desc, hdr, btn, img, dntShwAgKy) =>
                        {
                            description = desc;
                            header = hdr;
                            buttons = btn;
                            popupWasCalled = true;
                            return MessageBoxResult.OK;
                        }
                };

            const string NameOfItemBeingDeleted = "Random button";
            //------------Execute Test---------------------------
            popupController.ShowDeleteConfirmation(NameOfItemBeingDeleted);
            //------------Assert Results-------------------------
            Assert.IsTrue(popupWasCalled);
            Assert.AreEqual(MessageBoxButton.YesNo, buttons);
            Assert.AreEqual("Are you sure?", header);
            Assert.AreEqual("Are you sure you want to delete " + NameOfItemBeingDeleted + "?", description);
        }
Ejemplo n.º 2
0
        public void PopupController_ShowInvalidCharacterMessage_SetProperties_AllPropertiesDisplayed()
        {
            //------------Setup for test--------------------------
            var popupWasCalled = false;
            string description = string.Empty;
            string header = string.Empty;
            string dontShowAgainKey = string.Empty;
            MessageBoxButton buttons = MessageBoxButton.OK;
            MessageBoxImage imageType = MessageBoxImage.Error;
            const string expectedDesc = "some invalid text is invalid. Warewolf only supports latin characters";

            var popupController = new PopupController
            {
                ShowDev2MessageBox = (desc, hdr, btn, img, dntShwAgKy) =>
                {
                    description = desc;
                    header = hdr;
                    buttons = btn;
                    imageType = img;
                    popupWasCalled = true;
                    dontShowAgainKey = dntShwAgKy;
                    return MessageBoxResult.OK;
                }
            };

            //------------Execute Test---------------------------
            popupController.ShowInvalidCharacterMessage("some invalid text");
            //------------Assert Results-------------------------
            Assert.IsTrue(popupWasCalled);
            Assert.AreEqual(MessageBoxButton.OK, buttons);
            Assert.AreEqual("Invalid text", header);
            Assert.AreEqual(expectedDesc, description);
            Assert.AreEqual(MessageBoxImage.Error, imageType);
            Assert.AreEqual(null, dontShowAgainKey);
        }
Ejemplo n.º 3
0
        public void PopupController_ShowSettingsCloseConfirmation_SetProperties_AllPropertiesDisplayed()
        {
            //------------Setup for test--------------------------
            var popupWasCalled = false;
            string description = string.Empty;
            string header = string.Empty;
            MessageBoxButton buttons = MessageBoxButton.YesNoCancel;
            MessageBoxImage imageType = MessageBoxImage.Error;
            var expectedDesc = "Settings have not been saved." + Environment.NewLine
                              + "Would you like to save the settings? " + Environment.NewLine +
                              "-------------------------------------------------------------------" +
                              "Yes - Save the settings." + Environment.NewLine +
                              "No - Discard your changes." + Environment.NewLine +
                              "Cancel - Returns you to settings.";

            var popupController = new PopupController
            {
                ShowDev2MessageBox = (desc, hdr, btn, img, dntShwAgKy) =>
                {
                    description = desc;
                    header = hdr;
                    buttons = btn;
                    imageType = img;
                    popupWasCalled = true;
                    return MessageBoxResult.OK;
                }
            };

            //------------Execute Test---------------------------
            popupController.ShowSettingsCloseConfirmation();
            //------------Assert Results-------------------------
            Assert.IsTrue(popupWasCalled);
            Assert.AreEqual(MessageBoxButton.YesNoCancel, buttons);
            Assert.AreEqual("Settings have changed", header);
            Assert.AreEqual(expectedDesc, description);
            Assert.AreEqual(MessageBoxImage.Information, imageType);
        }
Ejemplo n.º 4
0
        public void PopupController_ShowSaveErrorDialog_SetProperties_AllPropertiesDisplayed()
        {
            //------------Setup for test--------------------------
            var popupWasCalled = false;
            string description = string.Empty;
            string header = string.Empty;
            MessageBoxButton buttons = MessageBoxButton.YesNoCancel;
            MessageBoxImage imageType = MessageBoxImage.Error;
            string errorMessage = string.Empty;

            var popupController = new PopupController
            {
                ShowDev2MessageBox = (desc, hdr, btn, img, dntShwAgKy) =>
                {
                    description = desc;
                    header = hdr;
                    buttons = btn;
                    imageType = img;
                    popupWasCalled = true;
                    return MessageBoxResult.OK;
                }
            };

            //------------Execute Test---------------------------
            popupController.ShowSaveErrorDialog(errorMessage);
            //------------Assert Results-------------------------
            Assert.IsTrue(popupWasCalled);
            Assert.AreEqual(MessageBoxButton.OK, buttons);
            Assert.AreEqual("Saving Error", header);
            Assert.AreEqual("The following error occurred on save:" + Environment.NewLine + errorMessage, description);
            Assert.AreEqual(MessageBoxImage.Error, imageType);
        }
Ejemplo n.º 5
0
        public void PopupController_ShowNotConnected_SetProperties_AllPropertiesDisplayed()
        {
            //------------Setup for test--------------------------
            var popupWasCalled = false;
            string description = string.Empty;
            string header = string.Empty;
            MessageBoxButton buttons = MessageBoxButton.YesNoCancel;
            MessageBoxImage imageType = MessageBoxImage.Error;

            var popupController = new PopupController
            {
                ShowDev2MessageBox = (desc, hdr, btn, img, dntShwAgKy) =>
                {
                    description = desc;
                    header = hdr;
                    buttons = btn;
                    imageType = img;
                    popupWasCalled = true;
                    return MessageBoxResult.OK;
                }
            };

            //------------Execute Test---------------------------
            popupController.ShowNotConnected();
            //------------Assert Results-------------------------
            Assert.IsTrue(popupWasCalled);
            Assert.AreEqual(MessageBoxButton.OK, buttons);
            Assert.AreEqual("Server is not connected", header);
            Assert.AreEqual("You can not change the settings for a server that is offline.", description);
            Assert.AreEqual(MessageBoxImage.Error, imageType);
        }
Ejemplo n.º 6
0
        public void PopupController_ShowNoInputsSelectedWhenClickLink_SetProperties_AllPropertiesDisplayed()
        {
            //------------Setup for test--------------------------
            var popupWasCalled = false;
            string description = string.Empty;
            string header = string.Empty;
            string dontShowAgainKey = string.Empty;
            MessageBoxButton buttons = MessageBoxButton.YesNoCancel;
            MessageBoxImage imageType = MessageBoxImage.Error;
            var expectedDesc = "You can pass variables into your workflow" + Environment.NewLine
                              + "by selecting the Input checkbox" + Environment.NewLine +
                              "in the Variables window.";

            var popupController = new PopupController
            {
                ShowDev2MessageBox = (desc, hdr, btn, img, dntShwAgKy) =>
                {
                    description = desc;
                    header = hdr;
                    buttons = btn;
                    imageType = img;
                    popupWasCalled = true;
                    dontShowAgainKey = dntShwAgKy;
                    return MessageBoxResult.OK;
                }
            };

            //------------Execute Test---------------------------
            popupController.ShowNoInputsSelectedWhenClickLink();
            //------------Assert Results-------------------------
            Assert.IsTrue(popupWasCalled);
            Assert.AreEqual(MessageBoxButton.OK, buttons);
            Assert.AreEqual("Did you know?", header);
            Assert.AreEqual(expectedDesc, description);
            Assert.AreEqual(MessageBoxImage.Information, imageType);
            Assert.AreEqual(GlobalConstants.Dev2MessageBoxNoInputsWhenHyperlinkClickedDialog, dontShowAgainKey);
        }
Ejemplo n.º 7
0
        public void PopupController_ShowNameChangedConflict_SetProperties_AllPropertiesDisplayed()
        {
            //------------Setup for test--------------------------
            var popupWasCalled = false;
            string description = string.Empty;
            string header = string.Empty;
            string oldName = string.Empty;
            string newName = string.Empty;
            MessageBoxButton buttons = MessageBoxButton.YesNoCancel;
            string expectedDescription = "The following task has been renamed " + oldName + " -> " + newName + ". You will lose the history for the old task." + Environment.NewLine +
                          " Would you like to save the new name?" + Environment.NewLine +
                          "-------------------------------------------------------------------" +
                          "Yes - Save with the new name." + Environment.NewLine +
                          "No - Save with the old name." + Environment.NewLine +
                          "Cancel - Returns you to Scheduler.";
            MessageBoxImage imageType = MessageBoxImage.Error;

            var popupController = new PopupController
            {
                ShowDev2MessageBox = (desc, hdr, btn, img, dntShwAgKy) =>
                {
                    description = desc;
                    header = hdr;
                    buttons = btn;
                    imageType = img;
                    popupWasCalled = true;
                    return MessageBoxResult.OK;
                }
            };

            //------------Execute Test---------------------------
            popupController.ShowNameChangedConflict(oldName, newName);
            //------------Assert Results-------------------------
            Assert.IsTrue(popupWasCalled);
            Assert.AreEqual(MessageBoxButton.YesNoCancel, buttons);
            Assert.AreEqual("Rename conflict", header);
            Assert.AreEqual(expectedDescription, description);
            Assert.AreEqual(MessageBoxImage.Information, imageType);
        }