Dev2.Core.Tests.PopupControllerTests.PopupController_ShowSettingsCloseConfirmation_SetProperties_AllPropertiesDisplayed C# (CSharp) Méthode

PopupController_ShowSettingsCloseConfirmation_SetProperties_AllPropertiesDisplayed() private méthode

        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);
        }