コード例 #1
0
ファイル: VerifyViews.cs プロジェクト: pvandervelde/Apollo
        public TestResult InitializeShowWelcomePageCheckbox(Application application, Log log)
        {
            const string prefix = "Initialize show welcome page";
            var result = new TestResult();
            try
            {
                WelcomePageControlProxies.UncheckShowWelcomePageOnApplicationStart(application, log);
            }
            catch (RegressionTestFailedException e)
            {
                var message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Failed with exception. Error: {0}",
                    e);
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
            }

            return result;
        }
コード例 #2
0
        private static void SelectMachineForDatasetActivation(Application application, Log log)
        {
            const string prefix = "Project page - Machine selection";
            var dialog = DialogProxies.DatasetMachineSelectionWindow(application, log);
            if (dialog == null)
            {
                throw new RegressionTestFailedException(prefix + " - Failed to get the machine selection window.");
            }

            var listSearchCriteria = SearchCriteria
                .ByAutomationId(MachineSelectorViewAutomationIds.AvailableMachines);
            var list = Retry.Times(
                () =>
                {
                    log.Debug(prefix, "Trying to get available machines list.");
                    var listBox = dialog.Get<ListBox>(listSearchCriteria);
                    if (listBox == null)
                    {
                        log.Error(prefix, "Failed to get the available machines list.");
                    }

                    return listBox;
                });
            if (list == null)
            {
                list = (ListBox)ControlProxies.FindItemManuallyInUIContainer(
                    dialog,
                    MachineSelectorViewAutomationIds.AvailableMachines,
                    log);
                if (list == null)
                {
                    throw new RegressionTestFailedException(prefix + " - Failed to get the available machines list.");
                }
            }

            // Find the item that matches the current machine
            var item = list.Items.Find(i => string.Equals(Environment.MachineName, i.Text));
            if (item == null)
            {
                log.Debug(
                    prefix,
                    string.Format(
                        CultureInfo.InvariantCulture,
                        "Expected machine with name [{0}] but found following machines: [{1}]",
                        Environment.MachineName,
                        list.Items.Aggregate(
                            string.Empty,
                            (c, i) =>
                            {
                                var next = string.Format(
                                    CultureInfo.InvariantCulture,
                                    "; [{0}]",
                                    i.Text);
                                return c + next;
                            })));

                throw new RegressionTestFailedException(prefix + " - Failed to get the item for the current machine.");
            }

            item.Select();

            var buttonSearchCriteria = SearchCriteria
                .ByAutomationId(MachineSelectorViewAutomationIds.ConfirmSelection);
            var confirmButton = Retry.Times(
                () =>
                {
                    log.Debug(prefix, "Trying to get confirm button.");
                    var button = dialog.Get<Button>(buttonSearchCriteria);
                    if (button == null)
                    {
                        log.Error(prefix, "Failed to get the confirm button.");
                    }

                    return button;
                });
            if (confirmButton == null)
            {
                confirmButton = (Button)ControlProxies.FindItemManuallyInUIContainer(
                    dialog,
                    MachineSelectorViewAutomationIds.ConfirmSelection,
                    log);
                if (confirmButton == null)
                {
                    throw new RegressionTestFailedException(prefix + " - Failed to get the machine selection confirm button.");
                }
            }

            try
            {
                confirmButton.Click();
            }
            catch (Exception e)
            {
                throw new RegressionTestFailedException(prefix + " - Failed to confirm the machine selection.", e);
            }
        }
コード例 #3
0
ファイル: LogFacts.cs プロジェクト: justdude/DbExport
            public void Error_ExceptionWithMessageFormat_MessageFormatNull()
            {
                LogManager.AddDebugListener();
                var log = new Log(typeof (int));

                var exception = new ArgumentNullException("log test");

                log.Error(exception, null, 1);
            }
コード例 #4
0
ファイル: LogFacts.cs プロジェクト: justdude/DbExport
            public void Error_ExceptionWithMessage_ExceptionNull()
            {
                LogManager.AddDebugListener();
                var log = new Log(typeof (int));

                ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => log.Error(null, string.Empty));
            }
コード例 #5
0
ファイル: LogFacts.cs プロジェクト: justdude/DbExport
            public void Error_MessageFormat()
            {
                LogManager.AddDebugListener();
                var log = new Log(typeof (int));

                LogMessageEventArgs eventArgs = null;
                log.LogMessage += (sender, e) => eventArgs = e;

                log.Error("log message {0}", 1);

                Assert.IsNotNull(eventArgs);
                Assert.AreEqual(log, eventArgs.Log);
                Assert.AreEqual(LogEvent.Error, eventArgs.LogEvent);
                Assert.AreEqual("log message 1", eventArgs.Message);
            }
コード例 #6
0
ファイル: LogFacts.cs プロジェクト: justdude/DbExport
            public void CorrectlyLogsMessageWithBraces()
            {
                LogManager.AddDebugListener();
                var log = new Log(typeof(int));

                log.Error("This is a string with { and sometimes and ending }");
            }
コード例 #7
0
ファイル: StringTemplate.cs プロジェクト: whesius/allors
        internal void Generate(MetaPopulation metaPopulation, DirectoryInfo outputDirectory, string group, Log log)
        {
            var validation = metaPopulation.Validate();
            if (validation.ContainsErrors)
            {
                log.Error(this, "Meta population " + metaPopulation + " has validation errors.");
                return;
            }

            try
            {
                TemplateGroup templateGroup = new TemplateGroupFile(this.fileInfo.FullName, '$', '$');

                templateGroup.ErrorManager = new ErrorManager(new LogAdapter(log));

                var configurationTemplate = templateGroup.GetInstanceOf(TemplateConfiguration);
                configurationTemplate.Add(MetaKey, metaPopulation);
                configurationTemplate.Add(GroupKey, group);

                var configurationXml = new XmlDocument();
                configurationXml.LoadXml(configurationTemplate.Render());

                var location = new Location(outputDirectory);
                foreach (XmlElement generation in configurationXml.DocumentElement.SelectNodes(GenerationKey))
                {
                    var templateName = generation.GetAttribute(TemplateKey);
                    var template = templateGroup.GetInstanceOf(templateName);
                    var output = generation.GetAttribute(OutputKey);

                    template.Add(MetaKey, metaPopulation);
                    template.Add(GroupKey, group);

                    if (generation.HasAttribute(InputKey))
                    {
                        var input = new Guid(generation.GetAttribute(InputKey));
                        var objectType = metaPopulation.Find(input) as IObjectType;
                        if (objectType != null)
                        {
                            template.Add(ObjectTypeKey, objectType);
                        }
                        else
                        {
                            var relationType = metaPopulation.Find(input) as RelationType;
                            if (relationType != null)
                            {
                                template.Add(RelationTypeKey, relationType);
                            }
                            else
                            {
                                var inheritance = metaPopulation.Find(input) as Inheritance;
                                if (inheritance != null)
                                {
                                    template.Add(InheritanceKey, inheritance);
                                }
                                else
                                {
                                    var methodType = metaPopulation.Find(input) as MethodType;
                                    if (methodType != null)
                                    {
                                        template.Add(MethodTypeKey, methodType);
                                    }
                                    else
                                    {
                                        throw new ArgumentException(input + " was not found");
                                    }
                                }
                            }
                        }
                        //TODO: Super Domains
                    }

                    var result = template.Render();
                    location.Save(output, result);
                }
            }
            catch (Exception e)
            {
                log.Error(this, "Generation error : " + e.Message + "\n" + e.StackTrace);
            }
        }
コード例 #8
0
ファイル: MenuProxies.cs プロジェクト: pvandervelde/Apollo
        /// <summary>
        /// Returns the 'File- New' menu item.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <param name="log">The log object.</param>
        /// <returns>The 'File - New' menu item.</returns>
        public static Menu GetFileNewMenuItem(Application application, Log log)
        {
            const string prefix = "Menus - Get 'File - New' menu";
            var menu = GetMainMenu(application, log);
            if (menu == null)
            {
                return null;
            }

            var fileMenuSearchCriteria = SearchCriteria.ByAutomationId(MainMenuAutomationIds.File);
            var newSearchCriteria = SearchCriteria.ByAutomationId(MainMenuAutomationIds.FileNew);
            return Retry.Times(
                () =>
                {
                    log.Debug(prefix, "Trying to get the 'File - New' menu item.");

                    var menuItem = menu.MenuItemBy(fileMenuSearchCriteria, newSearchCriteria);
                    if (menuItem == null)
                    {
                        log.Error(prefix, "Failed to find the 'File - New' menu item.");
                    }

                    return menuItem;
                });
        }
コード例 #9
0
ファイル: LogFacts.cs プロジェクト: pars87/Catel
        public void Error_ExceptionWithMessageFormat_MessageFormatNull()
        {
            LogManager.RegisterDebugListener();
            var log = new Log(typeof(int));

            var exception = new ArgumentNullException("log test");

            ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => log.Error(exception, null, 1));
        }
コード例 #10
0
ファイル: LogFacts.cs プロジェクト: pars87/Catel
        public void Error_Exception()
        {
            LogManager.RegisterDebugListener();
            var log = new Log(typeof(int));

            LogMessageEventArgs eventArgs = null;
            log.LogMessage += (sender, e) => eventArgs = e;

            var exception = new ArgumentNullException("log test");
            log.Error(exception);

            Assert.IsNotNull(eventArgs);
            Assert.AreEqual(log, eventArgs.Log);
            Assert.AreEqual(LogEvent.Error, eventArgs.LogEvent);
            Assert.AreEqual(string.Format("[System.Int32] {0}\r\nParameter name: log test", ArgumentNullExceptionText), eventArgs.Message);
        }
コード例 #11
0
ファイル: LogFacts.cs プロジェクト: pars87/Catel
        public void Error_MessageFormat_Null()
        {
            LogManager.RegisterDebugListener();
            var log = new Log(typeof(int));

            ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => log.Error((string)null, null));
        }
コード例 #12
0
ファイル: LogFacts.cs プロジェクト: pars87/Catel
        public void Error_Message()
        {
            LogManager.RegisterDebugListener();
            var log = new Log(typeof(int));

            LogMessageEventArgs eventArgs = null;
            log.LogMessage += (sender, e) => eventArgs = e;

            log.Error("log message");

            Assert.IsNotNull(eventArgs);
            Assert.AreEqual(log, eventArgs.Log);
            Assert.AreEqual(LogEvent.Error, eventArgs.LogEvent);
            Assert.AreEqual("[System.Int32] log message", eventArgs.Message);
        }
コード例 #13
0
ファイル: TabProxies.cs プロジェクト: pvandervelde/Apollo
        public static ITabPage GetStartPageTabItem(Application application, Log log)
        {
            const string prefix = "Tabs - Get start page";
            var tab = GetMainTab(application, log);
            if (tab == null)
            {
                return null;
            }

            try
            {
                log.Debug(prefix, "Trying to get the 'Start page' tab item.");

                var startPage = tab.Pages.FirstOrDefault(p => string.Equals(WelcomeViewAutomationIds.Header, p.Id));
                if (startPage == null)
                {
                    log.Error(prefix, "Failed to get the 'Start page' tab item.");
                }

                return startPage;
            }
            catch (Exception)
            {
                return null;
            }
        }
コード例 #14
0
ファイル: TabProxies.cs プロジェクト: pvandervelde/Apollo
        /// <summary>
        /// Returns the tab control in the main window of the application.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <param name="log">The log object.</param>
        /// <returns>The tab control in the main window of the application.</returns>
        public static Tab GetMainTab(Application application, Log log)
        {
            const string prefix = "Tabs - Get main tab control";
            var mainWindow = DialogProxies.MainWindow(application, log);
            if (mainWindow == null)
            {
                return null;
            }

            var tabSearchCriteria = SearchCriteria
                .ByAutomationId(ShellAutomationIds.Tabs);
            return Retry.Times(
                () =>
                {
                    log.Debug(prefix, "Trying to get the main tab control.");

                    var tab = (Tab)mainWindow.Get(tabSearchCriteria);
                    if (tab == null)
                    {
                        log.Error(prefix, "Failed to get the main tab control.");
                    }

                    return tab;
                });
        }
コード例 #15
0
        private static void WaitForDatasetDeactivation(Application application, Log log, int id)
        {
            const string prefix = "Project page - Wait for dataset deactivation";
            var tab = TabProxies.GetProjectPageTabItem(application, log);
            if (tab == null)
            {
                throw new RegressionTestFailedException(prefix + " - Failed to get project tab.");
            }

            var textBlockId = string.Format(
                CultureInfo.InvariantCulture,
                "TextBlock_[{0}_[DatasetId: [{1}]]]",
                DatasetViewAutomationIds.DatasetRunningOn,
                id);
            var textBlockSearchCriteria = SearchCriteria
                .ByAutomationId(textBlockId);
            var label = tab.Get<Label>(textBlockSearchCriteria);
            if (label == null)
            {
                throw new RegressionTestFailedException(prefix + " - Failed to get the dataset status label.");
            }

            var endTime = DateTimeOffset.Now + s_DatasetActivationTime;
            while (DateTimeOffset.Now < endTime)
            {
                try
                {
                    var text = label.Text;
                    if (text.Contains("is not activated"))
                    {
                        return;
                    }

                    Thread.Sleep(500);
                }
                catch (Exception e)
                {
                    log.Error(
                        prefix,
                        string.Format(
                            CultureInfo.InvariantCulture,
                            "Failed to read the dataset status for dataset: {0}. Error was: {1}",
                            id,
                            e));
                }
            }
        }
コード例 #16
0
ファイル: VerifyViews.cs プロジェクト: pvandervelde/Apollo
        private TestResult VerifyTabBehaviour(Application application, Log log)
        {
            const string prefix = "Tabs";
            var result = new TestResult();
            var assert = new Assert(result, log);
            try
            {
                var startPage = TabProxies.GetStartPageTabItem(application, log);
                if (startPage == null)
                {
                    log.Info(prefix, "Opening start page.");
                    MenuProxies.SwitchToStartPageViaViewStartPageMenuItem(application, log);
                }

                // Make sure we don't close the welcome tab upon opening the project page
                WelcomePageControlProxies.UncheckCloseWelcomePageOnProjectOpen(application, log);

                var projectPage = TabProxies.GetProjectPageTabItem(application, log);
                if (projectPage == null)
                {
                    log.Info(prefix, "Opening project page.");
                    WelcomePageControlProxies.OpenProjectPageViaWelcomePageButton(application, log);
                }

                startPage = TabProxies.GetStartPageTabItem(application, log);
                if (startPage == null)
                {
                    var message = "Failed to open the start page.";
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);
                    return result;
                }

                projectPage = TabProxies.GetProjectPageTabItem(application, log);
                if (projectPage == null)
                {
                    var message = "Failed to open the project page.";
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);
                    return result;
                }

                try
                {
                    if (!startPage.IsSelected)
                    {
                        log.Info(prefix, "Setting focus to start page.");
                        startPage.Select();
                    }
                }
                catch (Exception e)
                {
                    var message = string.Format(
                        CultureInfo.InvariantCulture,
                        "Failed to select the start page tab. Error was: {0}",
                        e);
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);

                    return result;
                }

                assert.IsTrue(startPage.IsSelected, prefix + " - Start is selected");
                assert.IsFalse(projectPage.IsSelected, prefix + " - Project is not selected");

                MenuProxies.SwitchToProjectPageViaViewStartPageMenuItem(application, log);
                assert.IsFalse(startPage.IsSelected, prefix + " - Start is not selected");
                assert.IsTrue(projectPage.IsSelected, prefix + " - Project is selected");

                MenuProxies.SwitchToStartPageViaViewStartPageMenuItem(application, log);
                assert.IsTrue(startPage.IsSelected, prefix + " - Start is selected");
                assert.IsFalse(projectPage.IsSelected, prefix + " - Project is not selected");

                TabProxies.CloseProjectPageTab(application, log);
            }
            catch (RegressionTestFailedException e)
            {
                var message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Failed with exception. Error: {0}",
                    e);
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
            }

            return result;
        }
コード例 #17
0
ファイル: VerifyViews.cs プロジェクト: pvandervelde/Apollo
        public TestResult VerifyCloseOnProjectOpenCheckbox(Application application, Log log)
        {
            const string prefix = "Close welcome tab on project open";
            var result = new TestResult();
            var assert = new Assert(result, log);
            try
            {
                var startPage = TabProxies.GetStartPageTabItem(application, log);
                if (startPage == null)
                {
                    log.Info(prefix, "Opening start page.");
                    MenuProxies.SwitchToStartPageViaViewStartPageMenuItem(application, log);
                }

                startPage = TabProxies.GetStartPageTabItem(application, log);
                if (startPage == null)
                {
                    var message = "Failed to get the start page.";
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);
                    return result;
                }

                try
                {
                    if (!startPage.IsSelected)
                    {
                        log.Info(prefix, "Setting focus to start page.");
                        startPage.Select();
                    }
                }
                catch (Exception e)
                {
                    var message = string.Format(
                        CultureInfo.InvariantCulture,
                        "Failed to select the start page tab. Error was: {0}",
                        e);
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);

                    return result;
                }

                // Check 'keep open' flag
                WelcomePageControlProxies.UncheckCloseWelcomePageOnProjectOpen(application, log);

                // New button
                var newProjectSearchCriteria = SearchCriteria
                    .ByAutomationId(WelcomeViewAutomationIds.NewProject);
                var newProjectButton = (Button)startPage.Get(newProjectSearchCriteria);
                if (newProjectButton == null)
                {
                    var message = "Failed to get the 'New Project' button.";
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);
                    return result;
                }

                newProjectButton.Click();

                // Check that the start page hasn't been closed
                var currentStartPage = TabProxies.GetStartPageTabItem(application, log);
                assert.IsNotNull(currentStartPage, prefix + " - Start page does not exist after opening project");
                assert.IsFalse(currentStartPage.IsSelected, prefix + " - Start page is selected after opening project");

                var currentProjectPage = TabProxies.GetProjectPageTabItem(application, log);
                assert.IsNotNull(currentProjectPage, prefix + " - Project page does not exist after opening project");
                assert.IsTrue(currentProjectPage.IsSelected, prefix + " - Project page is not selected after opening project");

                // Check that File - close has been enabled
                var fileCloseMenu = MenuProxies.GetFileCloseMenuItem(application, log);
                assert.IsTrue(fileCloseMenu.Enabled, prefix + " - File - Close menu is not enabled");

                // HACK: It seems that the File menu stays open when we check the File - close menu item
                var fileMenu = MenuProxies.GetFileMenuItem(application, log);
                if (fileMenu == null)
                {
                    var message = "Failed to get the file menu.";
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);
                    return result;
                }

                if (fileMenu.IsFocussed)
                {
                    fileMenu.Click();
                }

                // Close the project via the close button on the tab page
                TabProxies.CloseProjectPageTab(application, log);

                WelcomePageControlProxies.CheckCloseWelcomePageOnProjectOpen(application, log);

                // New button
                newProjectButton.Click();

                // Check that the start page has been closed
                currentStartPage = TabProxies.GetStartPageTabItem(application, log);
                assert.IsNull(currentStartPage, prefix + " - Start page exists after opening project");

                // Close the project via the close button on the tab page
                TabProxies.CloseProjectPageTab(application, log);
                WelcomePageControlProxies.UncheckCloseWelcomePageOnProjectOpen(application, log);
            }
            catch (RegressionTestFailedException e)
            {
                var message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Failed with exception. Error: {0}",
                    e);
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
            }

            return result;
        }
コード例 #18
0
ファイル: VerifyViews.cs プロジェクト: pvandervelde/Apollo
        /// <summary>
        /// Verifies that the 'File' menu works as expected.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <param name="log">The log object.</param>
        /// <returns>The test result for the current test case.</returns>
        public TestResult VerifyFileMenu(Application application, Log log)
        {
            const string prefix = "File menu";
            var result = new TestResult();
            var assert = new Assert(result, log);
            try
            {
                var projectPage = TabProxies.GetProjectPageTabItem(application, log);
                if (projectPage != null)
                {
                    TabProxies.CloseProjectPageTab(application, log);
                }

                projectPage = TabProxies.GetProjectPageTabItem(application, log);
                assert.IsNull(projectPage, prefix + " - The project page was not closed.");

                MenuProxies.CreateNewProjectViaFileNewMenuItem(application, log);

                projectPage = TabProxies.GetProjectPageTabItem(application, log);
                assert.IsNotNull(projectPage, prefix + " - A new project was not created.");

                var fileCloseMenu = MenuProxies.GetFileCloseMenuItem(application, log);
                assert.IsTrue(fileCloseMenu.Enabled, prefix + " - File - Close menu is not enabled");

                MenuProxies.CloseProjectViaFileCloseMenuItem(application, log);

                projectPage = TabProxies.GetProjectPageTabItem(application, log);
                assert.IsNull(projectPage, prefix + " - The project page was not closed.");
            }
            catch (RegressionTestFailedException e)
            {
                var message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Failed with exception. Error: {0}",
                    e);
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
            }

            return result;
        }
コード例 #19
0
ファイル: MenuProxies.cs プロジェクト: pvandervelde/Apollo
        /// <summary>
        /// Returns the main menu of the application.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <param name="log">The log object.</param>
        /// <returns>The main menu of the application.</returns>
        public static MenuBar GetMainMenu(Application application, Log log)
        {
            const string prefix = "Menus - Get main menu";
            var mainWindow = DialogProxies.MainWindow(application, log);
            if (mainWindow == null)
            {
                return null;
            }

            var menuSearchCriteria = SearchCriteria
                .ByAutomationId(MainMenuAutomationIds.Menu)
                .AndControlType(ControlType.Menu);
            return Retry.Times(
                () =>
                {
                    log.Debug(prefix, "Trying to get main menu.");

                    var menu = (MenuBar)mainWindow.Get(menuSearchCriteria);
                    if (menu == null)
                    {
                        log.Error(prefix, "Failed to get the main menu.");
                    }

                    return menu;
                });
        }
コード例 #20
0
ファイル: VerifyViews.cs プロジェクト: pvandervelde/Apollo
        /// <summary>
        /// Verifies that the 'Help' menu works as expected.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <param name="log">The log object.</param>
        /// <returns>The test result for the current test case.</returns>
        public TestResult VerifyHelpMenu(Application application, Log log)
        {
            const string prefix = "Help menu";
            var result = new TestResult();
            try
            {
                // VerifyHelpItem();
                VerifyAboutDialog(application, log, result);
            }
            catch (RegressionTestFailedException e)
            {
                var message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Failed with exception. Error: {0}",
                    e);
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
            }

            return result;
        }
コード例 #21
0
ファイル: Config.aspx.cs プロジェクト: gdrapp/JJLatitude
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
              homeSeerApp = (hsapplication)Context.Items["Content"];

              // Used for debugging in VS
              if (homeSeerApp == null)
            homeSeerApp = Global.homeSeerApp;

              if (homeSeerApp == null)
            throw new Exception("Error loading HomeSeer application object");

              plugin = (HSPI)homeSeerApp.Plugin(App.PLUGIN_NAME);

              if (plugin == null)
            throw new Exception("Error getting a reference to the plug-in.  Is it loaded and enabled?");
            }
            catch (Exception ex)
            {
              Response.Write(ex.Message + ex.StackTrace);
            }
            log = Log.GetInstance("HSPI_JJLATITUDE.Web.Config", homeSeerApp);

              if (!IsPostBack)
            {

            log.Debug("Loading Config page");

            // Inject HomeSeer HTML
            litHSHeader.Text = HomeSeer.GetHeadContent(homeSeerApp);
            litHSBody.Text = HomeSeer.GetBodyContent(homeSeerApp);
            litHSFooter.Text = HomeSeer.GetFooterContent(homeSeerApp);

            try
            {
              lstLogLevel.SelectedValue = AppConfig.Read("Main", "LogLevel");
            }
            catch (Exception)
            {
              log.Error("Error reading config value: LogLevel");
            }

            try
            {
              lstUpdateFreq.SelectedValue = AppConfig.Read("Main", "UpdateFrequency");
            }
            catch (Exception)
            {
              log.Error("Error reading config value: UpdateFrequency");
            }

            try
            {
              chkLogFile.Checked = Convert.ToBoolean(AppConfig.Read("Main", "LogToFile"));
            }
            catch (Exception)
            {
              log.Error("Error reading config value: LogToFile");
            }

            try
            {
              chkLogHomeSeer.Checked = Convert.ToBoolean(AppConfig.Read("Main", "LogToHomeSeer"));
            }
            catch (Exception)
            {
              log.Error("Error reading config value: LogToHomeSeer");
            }

              }  // (!IsPostBack)
        }
コード例 #22
0
ファイル: VerifyViews.cs プロジェクト: pvandervelde/Apollo
        public TestResult VerifyShowWelcomePageCheckbox(Application application, Log log)
        {
            const string prefix = "Verify show welcome page";
            var result = new TestResult();
            var assert = new Assert(result, log);
            try
            {
                var startPage = TabProxies.GetStartPageTabItem(application, log);
                assert.IsNull(startPage, prefix + " - Start page was open on application start.");

                WelcomePageControlProxies.CheckShowWelcomePageOnApplicationStart(application, log);
            }
            catch (RegressionTestFailedException e)
            {
                var message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Failed with exception. Error: {0}",
                    e);
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
            }

            return result;
        }
コード例 #23
0
ファイル: LogFacts.cs プロジェクト: justdude/DbExport
            public void Error_MessageFormat_Null()
            {
                LogManager.AddDebugListener();
                var log = new Log(typeof (int));

                log.Error((string) null, null);
            }
コード例 #24
0
ファイル: VerifyViews.cs プロジェクト: pvandervelde/Apollo
        /// <summary>
        /// Verifies that the 'View' menu works as expected.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <param name="log">The log object.</param>
        /// <returns>The test result for the current test case.</returns>
        public TestResult VerifyViewMenu(Application application, Log log)
        {
            const string prefix = "View menu";
            var result = new TestResult();
            var assert = new Assert(result, log);
            try
            {
                var startPage = TabProxies.GetStartPageTabItem(application, log);
                if (startPage != null)
                {
                    log.Info(prefix, "Closing start page.");
                    TabProxies.CloseStartPageTab(application, log);
                }

                // Make sure we don't close the welcome tab upon opening the project page
                WelcomePageControlProxies.UncheckCloseWelcomePageOnProjectOpen(application, log);

                var projectPage = TabProxies.GetProjectPageTabItem(application, log);
                if (projectPage != null)
                {
                    log.Info(prefix, "Closing project page.");
                    TabProxies.CloseProjectPageTab(application, log);
                }

                // Open start page via view menu
                MenuProxies.SwitchToStartPageViaViewStartPageMenuItem(application, log);

                startPage = TabProxies.GetStartPageTabItem(application, log);
                assert.IsNotNull(startPage, prefix + " - Check start page exists after clicking start page menu item");
                assert.IsTrue(startPage.IsSelected, prefix + " - Check start page is focussed after clicking start page menu item");
            }
            catch (RegressionTestFailedException e)
            {
                var message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Failed with exception. Error: {0}",
                    e);
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
            }

            return result;
        }
コード例 #25
0
ファイル: LogFacts.cs プロジェクト: justdude/DbExport
            public void Error_Exception_Null()
            {
                LogManager.AddDebugListener();
                var log = new Log(typeof (int));

                ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => log.Error((Exception) null));
            }
コード例 #26
0
ファイル: VerifyViews.cs プロジェクト: pvandervelde/Apollo
        public TestResult VerifyWelcomeTab(Application application, Log log)
        {
            const string prefix = "Welcome tab";
            var result = new TestResult();
            var assert = new Assert(result, log);
            try
            {
                var startPage = TabProxies.GetStartPageTabItem(application, log);
                if (startPage == null)
                {
                    log.Info(prefix, "Opening start page.");
                    MenuProxies.SwitchToStartPageViaViewStartPageMenuItem(application, log);
                }

                startPage = TabProxies.GetStartPageTabItem(application, log);
                if (startPage == null)
                {
                    var message = "Failed to get the start page.";
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);
                    return result;
                }

                try
                {
                    if (!startPage.IsSelected)
                    {
                        log.Info(prefix, "Setting focus to start page.");
                        startPage.Select();
                    }
                }
                catch (Exception e)
                {
                    var message = string.Format(
                        CultureInfo.InvariantCulture,
                        "Failed to select the start page tab. Error was: {0}",
                        e);
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);

                    return result;
                }

                var applicationNameSearchCiteria = SearchCriteria
                    .ByAutomationId(WelcomeViewAutomationIds.ApplicationName);
                var nameLabel = Retry.Times(
                    () =>
                    {
                        log.Debug(prefix, "Trying to get the application name label.");
                        var label = (Label)startPage.Get(applicationNameSearchCiteria);
                        if (label == null)
                        {
                            log.Error(prefix, "Failed to find the application name label.");
                        }

                        return label;
                    });
                if (nameLabel == null)
                {
                    var message = "Failed to get the application name label.";
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);
                    return result;
                }

                var nameText = nameLabel.Text;
                assert.AreEqual(ProductInformation.ProductName, nameText, prefix + " - Product Name");
            }
            catch (RegressionTestFailedException e)
            {
                var message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Failed with exception. Error: {0}",
                    e);
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
            }

            return result;
        }
コード例 #27
0
ファイル: LogFacts.cs プロジェクト: justdude/DbExport
            public void Error_ExceptionWithMessageFormat_ExceptionNull()
            {
                LogManager.AddDebugListener();
                var log = new Log(typeof (int));

                ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => log.Error(null, "additional message", 1));
            }
コード例 #28
0
ファイル: VerifyViews.cs プロジェクト: pvandervelde/Apollo
        private static void VerifyAboutDialog(Application application, Log log, TestResult result)
        {
            const string prefix = "About dialog";
            var assert = new Assert(result, log);
            log.Info(prefix, "Verifying content ...");

            MenuProxies.OpenAboutDialogViaHelpAboutMenuItem(application, log);
            var dialog = DialogProxies.AboutWindow(application, log);
            if (dialog == null)
            {
                var message = "Failed to get dialog.";
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
                return;
            }

            // Check application name
            var applicationNameSearchCiteria = SearchCriteria
                .ByAutomationId(AboutAutomationIds.ProductName);
            var nameLabel = Retry.Times(() => (Label)dialog.Get(applicationNameSearchCiteria));
            if (nameLabel == null)
            {
                var message = "Failed to get name label.";
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
                return;
            }

            var nameText = nameLabel.Text;
            assert.AreEqual(ProductInformation.ProductName, nameText, prefix + " - Product name");

            // Check application version
            var applicationVersionSearchCriteria = SearchCriteria
                .ByAutomationId(AboutAutomationIds.ProductVersion);
            var versionLabel = Retry.Times(() => (Label)dialog.Get(applicationVersionSearchCriteria));
            if (versionLabel == null)
            {
                var message = "Failed to get version label.";
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
                return;
            }

            var versionText = versionLabel.Text;
            var versionAttribute = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false);
            var version = (versionAttribute[0] as AssemblyInformationalVersionAttribute).InformationalVersion;
            assert.AreEqual(version, versionText, prefix + " - Product version");

            // Check company name
            var companyNameSearchCriteria = SearchCriteria
                .ByAutomationId(AboutAutomationIds.CompanyName);
            var companyLabel = Retry.Times(() => (Label)dialog.Get(companyNameSearchCriteria));
            if (companyLabel == null)
            {
                var message = "Failed to get company label.";
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
                return;
            }

            var companyText = companyLabel.Text;
            assert.AreEqual(CompanyInformation.CompanyName, companyText, prefix + " - Company name");

            // Check copyright
            var copyrightSearchCriteria = SearchCriteria
                .ByAutomationId(AboutAutomationIds.Copyright);
            var copyrightLabel = Retry.Times(() => (Label)dialog.Get(copyrightSearchCriteria));
            if (copyrightLabel == null)
            {
                var message = "Failed to get copyright label.";
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
                return;
            }

            var copyrightText = copyrightLabel.Text;
            assert.AreEqual(
                string.Format(
                    CultureInfo.InvariantCulture,
                    "Copyright {0} 2009 - {1}",
                    CompanyInformation.CompanyName,
                    DateTimeOffset.Now.Year),
                copyrightText,
                prefix + " - Copyright");

            try
            {
                dialog.Close();
            }
            catch (Exception e)
            {
                var message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Failed to close the dialog. Error was: {0}",
                    e);
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
            }
        }
コード例 #29
0
ファイル: LogFacts.cs プロジェクト: justdude/DbExport
            public void Error_ExceptionWithMessageFormat()
            {
                LogManager.AddDebugListener();
                var log = new Log(typeof (int));

                LogMessageEventArgs eventArgs = null;
                log.LogMessage += (sender, e) => eventArgs = e;

                var exception = new ArgumentNullException("log test");
                log.Error(exception, "additional message {0}", 1);

                Assert.IsNotNull(eventArgs);
                Assert.AreEqual(log, eventArgs.Log);
                Assert.AreEqual(LogEvent.Error, eventArgs.LogEvent);
                Assert.AreEqual(string.Format("additional message 1 | {0}\r\nParameter name: log test", ArgumentNullExceptionText), eventArgs.Message);
            }
コード例 #30
0
        private static TextBox GetProjectSummaryTextControl(Application application, Log log)
        {
            const string prefix = "Project page - Get project summary control";
            var tab = TabProxies.GetProjectPageTabItem(application, log);
            if (tab == null)
            {
                return null;
            }

            var projectSummarySearchCriteria = SearchCriteria
                .ByAutomationId(ProjectViewAutomationIds.ProjectSummary);
            return Retry.Times(
                () =>
                {
                    log.Debug(prefix, "Trying to get the project summary control.");

                    var textBox = (TextBox)tab.Get(projectSummarySearchCriteria);
                    if (textBox == null)
                    {
                        log.Error(prefix, "Failed to get the project summary control.");
                    }

                    return textBox;
                });
        }