From 9a7a6a9da17a1bf05358fec9010d0aefd3348d47 Mon Sep 17 00:00:00 2001 From: N <71219152+PokeCodec@users.noreply.github.com> Date: Mon, 9 Nov 2020 13:05:03 -0500 Subject: [PATCH] Fixup tests Description of the changes: - Removed unneeded "ToString" calls - Fixed typos - Renamed "fEButtonState" to "FEButtonState" --- src/CalculatorUITestFramework/MemoryPanel.cs | 2 +- src/CalculatorUITestFramework/NumberPad.cs | 3 ++- src/CalculatorUITestFramework/ScientificOperatorsPanel.cs | 4 ++-- src/CalculatorUITestFramework/StandardAoTCalculatorPage.cs | 3 +-- src/CalculatorUITestFramework/StandardCalculatorPage.cs | 2 +- src/CalculatorUITestFramework/WinAppDriver.cs | 4 ++-- src/CalculatorUITestFramework/WindowsDriverLocalService.cs | 4 ++-- src/CalculatorUITestFramework/WindowsElementExtensions.cs | 2 +- src/CalculatorUITests/ScientificModeFunctionalTests.cs | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/CalculatorUITestFramework/MemoryPanel.cs b/src/CalculatorUITestFramework/MemoryPanel.cs index f1233d16..e8cc3f80 100644 --- a/src/CalculatorUITestFramework/MemoryPanel.cs +++ b/src/CalculatorUITestFramework/MemoryPanel.cs @@ -82,7 +82,7 @@ namespace CalculatorUITestFramework /// /// If the Memory label is not displayed, resize the window - /// Two attempts are made, the the lable is not found a "not found" exception is thrown + /// Two attempts are made, and if the label is not found, a "not found" exception is thrown /// public void ResizeWindowToDisplayMemoryLabel() { diff --git a/src/CalculatorUITestFramework/NumberPad.cs b/src/CalculatorUITestFramework/NumberPad.cs index 5e5bcf2f..306baaab 100644 --- a/src/CalculatorUITestFramework/NumberPad.cs +++ b/src/CalculatorUITestFramework/NumberPad.cs @@ -3,6 +3,7 @@ using OpenQA.Selenium.Appium.Windows; using System; +using System.Globalization; namespace CalculatorUITestFramework { @@ -29,7 +30,7 @@ namespace CalculatorUITestFramework /// Number to be entered into the calculator. public void Input(double number) { - string numberStr = number.ToString(); + string numberStr = number.ToString(CultureInfo.InvariantCulture); if (numberStr.StartsWith("-")) { numberStr = numberStr.Substring(1) + "-"; diff --git a/src/CalculatorUITestFramework/ScientificOperatorsPanel.cs b/src/CalculatorUITestFramework/ScientificOperatorsPanel.cs index 11ad88b9..0971ddda 100644 --- a/src/CalculatorUITestFramework/ScientificOperatorsPanel.cs +++ b/src/CalculatorUITestFramework/ScientificOperatorsPanel.cs @@ -18,7 +18,7 @@ namespace CalculatorUITestFramework Gradians } - public enum fEButtonState + public enum FEButtonState { Normal, Exponential @@ -133,7 +133,7 @@ namespace CalculatorUITestFramework } } - public void ResetFEButton(fEButtonState value) + public void ResetFEButton(FEButtonState value) { if (this.FixedToExponentialButton.GetAttribute("Toggle.ToggleState") != "0") { diff --git a/src/CalculatorUITestFramework/StandardAoTCalculatorPage.cs b/src/CalculatorUITestFramework/StandardAoTCalculatorPage.cs index 1a4070eb..79a8777d 100644 --- a/src/CalculatorUITestFramework/StandardAoTCalculatorPage.cs +++ b/src/CalculatorUITestFramework/StandardAoTCalculatorPage.cs @@ -90,8 +90,7 @@ namespace CalculatorUITestFramework { throw new NotFoundException("Could not find 'Keep on top' button or 'Back to full view' button"); } - var ToolTipText = ToolTip.Text.ToString(); - return ToolTipText; + return ToolTip.Text; } ///// diff --git a/src/CalculatorUITestFramework/StandardCalculatorPage.cs b/src/CalculatorUITestFramework/StandardCalculatorPage.cs index 72439b5e..aa56c893 100644 --- a/src/CalculatorUITestFramework/StandardCalculatorPage.cs +++ b/src/CalculatorUITestFramework/StandardCalculatorPage.cs @@ -20,7 +20,7 @@ namespace CalculatorUITestFramework private WindowsDriver session => WinAppDriver.Instance.CalculatorSession; /// - /// Navigates the caclulator to Standard mode and ensures that it is in standard mode + /// Navigates the calculator to Standard mode and ensures that it is in standard mode /// public void NavigateToStandardCalculator() { diff --git a/src/CalculatorUITestFramework/WinAppDriver.cs b/src/CalculatorUITestFramework/WinAppDriver.cs index bf61f4df..70901256 100644 --- a/src/CalculatorUITestFramework/WinAppDriver.cs +++ b/src/CalculatorUITestFramework/WinAppDriver.cs @@ -38,14 +38,14 @@ namespace CalculatorUITestFramework { this.windowsDriverService = new WindowsDriverServiceBuilder().Build(); - this.windowsDriverService.OutputDataReceived += new DataReceivedEventHandler((sender, e) => + this.windowsDriverService.OutputDataReceived += (sender, e) => { var outputData = e.Data?.Replace("\0", string.Empty); if (!String.IsNullOrEmpty(outputData)) { Console.WriteLine(outputData); } - }); + }; this.windowsDriverService.Start(); diff --git a/src/CalculatorUITestFramework/WindowsDriverLocalService.cs b/src/CalculatorUITestFramework/WindowsDriverLocalService.cs index df3e0e54..8d6c4a50 100644 --- a/src/CalculatorUITestFramework/WindowsDriverLocalService.cs +++ b/src/CalculatorUITestFramework/WindowsDriverLocalService.cs @@ -122,7 +122,7 @@ namespace CalculatorUITestFramework public Uri ServiceUrl { // Note: append /wd/hub to the URL if you're directing the test at Appium - get { return new Uri($"http://{this.IP.ToString()}:{Convert.ToString(this.Port)}"); } + get { return new Uri($"http://{this.IP}:{Convert.ToString(this.Port)}"); } } private void DestroyProcess() @@ -158,7 +158,7 @@ namespace CalculatorUITestFramework } else { - status = new Uri(service.ToString() + "/status"); + status = new Uri(service + "/status"); } DateTime endTime = DateTime.Now.Add(this.InitializationTimeout); diff --git a/src/CalculatorUITestFramework/WindowsElementExtensions.cs b/src/CalculatorUITestFramework/WindowsElementExtensions.cs index 773548d6..a1937727 100644 --- a/src/CalculatorUITestFramework/WindowsElementExtensions.cs +++ b/src/CalculatorUITestFramework/WindowsElementExtensions.cs @@ -33,7 +33,7 @@ namespace CalculatorUITestFramework Thread.Sleep(10); } timer.Stop(); - Assert.Fail(String.Format("{0} was not displayed in {1} ms", element, timeout)); + Assert.Fail($"{element} was not displayed in {timeout} ms"); } } } diff --git a/src/CalculatorUITests/ScientificModeFunctionalTests.cs b/src/CalculatorUITests/ScientificModeFunctionalTests.cs index c576de0e..eaccc1ee 100644 --- a/src/CalculatorUITests/ScientificModeFunctionalTests.cs +++ b/src/CalculatorUITests/ScientificModeFunctionalTests.cs @@ -54,7 +54,7 @@ namespace CalculatorUITests } CalculatorApp.EnsureCalculatorHasFocus(); page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees); - page.ScientificOperators.ResetFEButton(fEButtonState.Normal); + page.ScientificOperators.ResetFEButton(FEButtonState.Normal); } [TestCleanup]