Fixup tests (#1429)

- Removed unneeded "ToString" calls
- Fixed typos
- Renamed "fEButtonState" to "FEButtonState"
This commit is contained in:
N 2021-01-11 17:40:27 -05:00 committed by GitHub
parent 737cd15562
commit 66ad328d00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 13 additions and 13 deletions

View File

@ -82,7 +82,7 @@ public void ClearMemoryPanel()
/// <summary> /// <summary>
/// If the Memory label is not displayed, resize the window /// 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
/// </summary> /// </summary>
public void ResizeWindowToDisplayMemoryLabel() public void ResizeWindowToDisplayMemoryLabel()
{ {

View File

@ -3,6 +3,7 @@
using OpenQA.Selenium.Appium.Windows; using OpenQA.Selenium.Appium.Windows;
using System; using System;
using System.Globalization;
namespace CalculatorUITestFramework namespace CalculatorUITestFramework
{ {
@ -29,7 +30,7 @@ public class NumberPad
/// <param name="number">Number to be entered into the calculator.</param> /// <param name="number">Number to be entered into the calculator.</param>
public void Input(double number) public void Input(double number)
{ {
string numberStr = number.ToString(); string numberStr = number.ToString(CultureInfo.InvariantCulture);
if (numberStr.StartsWith("-")) if (numberStr.StartsWith("-"))
{ {
numberStr = numberStr.Substring(1) + "-"; numberStr = numberStr.Substring(1) + "-";

View File

@ -18,7 +18,7 @@ public enum AngleOperatorState
Gradians Gradians
} }
public enum fEButtonState public enum FEButtonState
{ {
Normal, Normal,
Exponential Exponential
@ -133,7 +133,7 @@ public void SetAngleOperator(AngleOperatorState value)
} }
} }
public void ResetFEButton(fEButtonState value) public void ResetFEButton(FEButtonState value)
{ {
if (this.FixedToExponentialButton.GetAttribute("Toggle.ToggleState") != "0") if (this.FixedToExponentialButton.GetAttribute("Toggle.ToggleState") != "0")
{ {

View File

@ -90,8 +90,7 @@ public string GetAoTToolTipText()
{ {
throw new NotFoundException("Could not find 'Keep on top' button or 'Back to full view' button"); throw new NotFoundException("Could not find 'Keep on top' button or 'Back to full view' button");
} }
var ToolTipText = ToolTip.Text.ToString(); return ToolTip.Text;
return ToolTipText;
} }
///// <summary> ///// <summary>

View File

@ -20,7 +20,7 @@ public class StandardCalculatorPage
private WindowsDriver<WindowsElement> session => WinAppDriver.Instance.CalculatorSession; private WindowsDriver<WindowsElement> session => WinAppDriver.Instance.CalculatorSession;
/// <summary> /// <summary>
/// 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
/// </summary> /// </summary>
public void NavigateToStandardCalculator() public void NavigateToStandardCalculator()
{ {

View File

@ -38,14 +38,14 @@ public void SetupCalculatorSession(TestContext context)
{ {
this.windowsDriverService = new WindowsDriverServiceBuilder().Build(); 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); var outputData = e.Data?.Replace("\0", string.Empty);
if (!String.IsNullOrEmpty(outputData)) if (!String.IsNullOrEmpty(outputData))
{ {
Console.WriteLine(outputData); Console.WriteLine(outputData);
} }
}); };
this.windowsDriverService.Start(); this.windowsDriverService.Start();

View File

@ -122,7 +122,7 @@ public void Dispose()
public Uri ServiceUrl public Uri ServiceUrl
{ {
// Note: append /wd/hub to the URL if you're directing the test at Appium // 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() private void DestroyProcess()
@ -158,7 +158,7 @@ private bool Ping()
} }
else else
{ {
status = new Uri(service.ToString() + "/status"); status = new Uri(service + "/status");
} }
DateTime endTime = DateTime.Now.Add(this.InitializationTimeout); DateTime endTime = DateTime.Now.Add(this.InitializationTimeout);

View File

@ -33,7 +33,7 @@ public static void WaitForDisplayed(this WindowsElement element, int timeout = 2
Thread.Sleep(10); Thread.Sleep(10);
} }
timer.Stop(); timer.Stop();
Assert.Fail(String.Format("{0} was not displayed in {1} ms", element, timeout)); Assert.Fail($"{element} was not displayed in {timeout} ms");
} }
} }
} }

View File

@ -54,7 +54,7 @@ public void TestInit()
} }
CalculatorApp.EnsureCalculatorHasFocus(); CalculatorApp.EnsureCalculatorHasFocus();
page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees); page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
page.ScientificOperators.ResetFEButton(fEButtonState.Normal); page.ScientificOperators.ResetFEButton(FEButtonState.Normal);
} }
[TestCleanup] [TestCleanup]