Skip to content

Commit

Permalink
Fixup tests (#1429)
Browse files Browse the repository at this point in the history
- Removed unneeded "ToString" calls
- Fixed typos
- Renamed "fEButtonState" to "FEButtonState"
  • Loading branch information
N committed Jan 11, 2021
1 parent 737cd15 commit 66ad328
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/CalculatorUITestFramework/MemoryPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void ClearMemoryPanel()

/// <summary>
/// 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>
public void ResizeWindowToDisplayMemoryLabel()
{
Expand Down
3 changes: 2 additions & 1 deletion src/CalculatorUITestFramework/NumberPad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using OpenQA.Selenium.Appium.Windows;
using System;
using System.Globalization;

namespace CalculatorUITestFramework
{
Expand All @@ -29,7 +30,7 @@ public class NumberPad
/// <param name="number">Number to be entered into the calculator.</param>
public void Input(double number)
{
string numberStr = number.ToString();
string numberStr = number.ToString(CultureInfo.InvariantCulture);
if (numberStr.StartsWith("-"))
{
numberStr = numberStr.Substring(1) + "-";
Expand Down
4 changes: 2 additions & 2 deletions src/CalculatorUITestFramework/ScientificOperatorsPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public enum AngleOperatorState
Gradians
}

public enum fEButtonState
public enum FEButtonState
{
Normal,
Exponential
Expand Down Expand Up @@ -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")
{
Expand Down
3 changes: 1 addition & 2 deletions src/CalculatorUITestFramework/StandardAoTCalculatorPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ public string GetAoTToolTipText()
{
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;
}

///// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/CalculatorUITestFramework/StandardCalculatorPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class StandardCalculatorPage
private WindowsDriver<WindowsElement> session => WinAppDriver.Instance.CalculatorSession;

/// <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>
public void NavigateToStandardCalculator()
{
Expand Down
4 changes: 2 additions & 2 deletions src/CalculatorUITestFramework/WinAppDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ public void SetupCalculatorSession(TestContext context)
{
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();

Expand Down
4 changes: 2 additions & 2 deletions src/CalculatorUITestFramework/WindowsDriverLocalService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void Dispose()
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()
Expand Down Expand Up @@ -158,7 +158,7 @@ private bool Ping()
}
else
{
status = new Uri(service.ToString() + "/status");
status = new Uri(service + "/status");
}

DateTime endTime = DateTime.Now.Add(this.InitializationTimeout);
Expand Down
2 changes: 1 addition & 1 deletion src/CalculatorUITestFramework/WindowsElementExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static void WaitForDisplayed(this WindowsElement element, int timeout = 2
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");
}
}
}
2 changes: 1 addition & 1 deletion src/CalculatorUITests/ScientificModeFunctionalTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void TestInit()
}
CalculatorApp.EnsureCalculatorHasFocus();
page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
page.ScientificOperators.ResetFEButton(fEButtonState.Normal);
page.ScientificOperators.ResetFEButton(FEButtonState.Normal);
}

[TestCleanup]
Expand Down

0 comments on commit 66ad328

Please sign in to comment.