Created
September 3, 2017 16:27
-
-
Save angelovstanton/fc73f1a88debeb89d0916bdcd4a545fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestFixture] | |
public class CalculatorPageObjectsTests | |
{ | |
private WindowsDriver<WindowsElement> _driver; | |
private CalculatorStandardView _calcStandardView; | |
[SetUp] | |
public void TestInit() | |
{ | |
var appCapabilities = new DesiredCapabilities(); | |
appCapabilities.SetCapability("app", "Microsoft.WindowsCalculator_8wekyb3d8bbwe!App"); | |
appCapabilities.SetCapability("deviceName", "WindowsPC"); | |
_driver = new WindowsDriver<WindowsElement>(new Uri("http://127.0.0.1:4723"), appCapabilities); | |
_driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5)); | |
_calcStandardView = new CalculatorStandardView(_driver); | |
} | |
[TearDown] | |
public void TestCleanup() | |
{ | |
if (_driver != null) | |
{ | |
_driver.Quit(); | |
_driver = null; | |
} | |
} | |
[Test] | |
public void Addition() | |
{ | |
_calcStandardView.PerformCalculation(5, '+', 7); | |
_calcStandardView.AssertResult(12); | |
} | |
[Test] | |
public void Division() | |
{ | |
_calcStandardView.PerformCalculation(8, '/', 1); | |
_calcStandardView.AssertResult(8); | |
} | |
[Test] | |
public void Multiplication() | |
{ | |
_calcStandardView.PerformCalculation(9, '*', 9); | |
_calcStandardView.AssertResult(81); | |
} | |
[Test] | |
public void Subtraction() | |
{ | |
_calcStandardView.PerformCalculation(9, '-', 1); | |
_calcStandardView.AssertResult(8); | |
} | |
[Test] | |
[TestCase(1, '+', 7, 8)] | |
[TestCase(9, '-', 7, 2)] | |
[TestCase(8, '/', 4, 2)] | |
public void Templatized(int num1, char operation, int num2, decimal result) | |
{ | |
_calcStandardView.PerformCalculation(num1, operation, num2); | |
_calcStandardView.AssertResult(result); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment