mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-23 06:25:19 -07:00
Adding code review feedback.
This commit is contained in:
parent
d1736a692d
commit
8faa952567
3 changed files with 56 additions and 4 deletions
|
@ -474,7 +474,9 @@ void UnitConverterViewModel::OnButtonPressed(Platform::Object ^ parameter)
|
||||||
|
|
||||||
static constexpr UCM::Command OPERANDS[] = { UCM::Command::Zero, UCM::Command::One, UCM::Command::Two, UCM::Command::Three, UCM::Command::Four,
|
static constexpr UCM::Command OPERANDS[] = { UCM::Command::Zero, UCM::Command::One, UCM::Command::Two, UCM::Command::Three, UCM::Command::Four,
|
||||||
UCM::Command::Five, UCM::Command::Six, UCM::Command::Seven, UCM::Command::Eight, UCM::Command::Nine };
|
UCM::Command::Five, UCM::Command::Six, UCM::Command::Seven, UCM::Command::Eight, UCM::Command::Nine };
|
||||||
if (m_isInputBlocked && (command != UCM::Command::Clear && command != UCM::Command::Backspace))
|
if (m_isInputBlocked &&
|
||||||
|
command != UCM::Command::Clear &&
|
||||||
|
command != UCM::Command::Backspace)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ using System;
|
||||||
namespace CalculatorUITests
|
namespace CalculatorUITests
|
||||||
{
|
{
|
||||||
[TestClass]
|
[TestClass]
|
||||||
public class UnitConverterFunctionalTests
|
public class CurrencyConverterFunctionalTests
|
||||||
{
|
{
|
||||||
private static UnitConverterPage page = new UnitConverterPage();
|
private static UnitConverterPage page = new UnitConverterPage();
|
||||||
|
|
||||||
|
@ -51,13 +51,26 @@ namespace CalculatorUITests
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Basic UI Functionality via Mouse Input Tests
|
#region Basic UI Functionality via Mouse Input Tests
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// These automated tests verify clicking each of the buttons in the Calculator UI and getting an expected result
|
/// These automated tests verify clicking each of the buttons in the Calculator UI and getting an expected result
|
||||||
/// Via mouse input, all basic UI functionality is checked
|
/// Via mouse input, all basic UI functionality is checked
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[Priority(0)]
|
[Priority(0)]
|
||||||
|
public void MouseInput_EnterInputAndCheckTheResult()
|
||||||
|
{
|
||||||
|
//Verifies the 2 is entered and clear is functional
|
||||||
|
page.UnitConverterOperators.NumberPad.Num2Button.Click();
|
||||||
|
Assert.AreEqual("2", page.UnitConverterResults.GetCalculationResult1Text()); //verifies 2 button
|
||||||
|
Assert.AreEqual("2", page.UnitConverterResults.GetCalculationResult2Text()); //verifies 2 button
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// These automated tests verify clicking each of the buttons in the Calculator UI and getting an expected result
|
||||||
|
/// Via mouse input, all basic UI functionality is checked
|
||||||
|
/// </summary>
|
||||||
|
[TestMethod]
|
||||||
|
[Priority(1)]
|
||||||
public void MouseInput_EnterInputWithFullDecimalAndClear()
|
public void MouseInput_EnterInputWithFullDecimalAndClear()
|
||||||
{
|
{
|
||||||
//Verifies the 20.42 is entered and clear is functional
|
//Verifies the 20.42 is entered and clear is functional
|
||||||
|
@ -87,7 +100,7 @@ namespace CalculatorUITests
|
||||||
/// Via mouse input, all basic UI functionality is checked
|
/// Via mouse input, all basic UI functionality is checked
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[Priority(0)]
|
[Priority(1)]
|
||||||
public void MouseInput_EnterInputWithFullDecimalAndClearWithBackspace()
|
public void MouseInput_EnterInputWithFullDecimalAndClearWithBackspace()
|
||||||
{
|
{
|
||||||
//Verifies the 20.42 is entered and clear is functional
|
//Verifies the 20.42 is entered and clear is functional
|
|
@ -202,6 +202,8 @@ namespace UnitConverterUnitTests
|
||||||
TEST_METHOD(UnitConverterTestQuote);
|
TEST_METHOD(UnitConverterTestQuote);
|
||||||
TEST_METHOD(UnitConverterTestUnquote);
|
TEST_METHOD(UnitConverterTestUnquote);
|
||||||
TEST_METHOD(UnitConverterTestBackspace);
|
TEST_METHOD(UnitConverterTestBackspace);
|
||||||
|
TEST_METHOD(UnitConverterTestBackspaceBasic);
|
||||||
|
TEST_METHOD(UnitConverterTestClear);
|
||||||
TEST_METHOD(UnitConverterTestScientificInputs);
|
TEST_METHOD(UnitConverterTestScientificInputs);
|
||||||
TEST_METHOD(UnitConverterTestSupplementaryResultRounding);
|
TEST_METHOD(UnitConverterTestSupplementaryResultRounding);
|
||||||
TEST_METHOD(UnitConverterTestMaxDigitsReached);
|
TEST_METHOD(UnitConverterTestMaxDigitsReached);
|
||||||
|
@ -291,6 +293,41 @@ namespace UnitConverterUnitTests
|
||||||
VERIFY_IS_TRUE(s_testVMCallback->CheckSuggestedValues(vector<tuple<wstring, Unit>>(begin(test2), end(test2))));
|
VERIFY_IS_TRUE(s_testVMCallback->CheckSuggestedValues(vector<tuple<wstring, Unit>>(begin(test2), end(test2))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Verify a basic copy paste steam. '20.43' with backspace button pressed
|
||||||
|
void UnitConverterTest::UnitConverterTestBackspaceBasic()
|
||||||
|
{
|
||||||
|
s_unitConverter->SendCommand(Command::Two);
|
||||||
|
s_unitConverter->SendCommand(Command::Zero);
|
||||||
|
s_unitConverter->SendCommand(Command::Decimal);
|
||||||
|
s_unitConverter->SendCommand(Command::Four);
|
||||||
|
s_unitConverter->SendCommand(Command::Three);
|
||||||
|
s_unitConverter->SendCommand(Command::Backspace);
|
||||||
|
|
||||||
|
VERIFY_IS_TRUE(s_testVMCallback->CheckDisplayValues(wstring(L"20.4"), wstring(L"20.4")));
|
||||||
|
s_unitConverter->SendCommand(Command::Backspace);
|
||||||
|
VERIFY_IS_TRUE(s_testVMCallback->CheckDisplayValues(wstring(L"20."), wstring(L"20")));
|
||||||
|
s_unitConverter->SendCommand(Command::Backspace);
|
||||||
|
VERIFY_IS_TRUE(s_testVMCallback->CheckDisplayValues(wstring(L"20"), wstring(L"20")));
|
||||||
|
s_unitConverter->SendCommand(Command::Backspace);
|
||||||
|
VERIFY_IS_TRUE(s_testVMCallback->CheckDisplayValues(wstring(L"2"), wstring(L"2")));
|
||||||
|
s_unitConverter->SendCommand(Command::Backspace);
|
||||||
|
VERIFY_IS_TRUE(s_testVMCallback->CheckDisplayValues(wstring(L"0"), wstring(L"0")));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify a basic copy paste steam. '20.43' with backspace button pressed
|
||||||
|
void UnitConverterTest::UnitConverterTestClear()
|
||||||
|
{
|
||||||
|
s_unitConverter->SendCommand(Command::Two);
|
||||||
|
s_unitConverter->SendCommand(Command::Zero);
|
||||||
|
s_unitConverter->SendCommand(Command::Decimal);
|
||||||
|
s_unitConverter->SendCommand(Command::Four);
|
||||||
|
s_unitConverter->SendCommand(Command::Three);
|
||||||
|
s_unitConverter->SendCommand(Command::Clear);
|
||||||
|
|
||||||
|
VERIFY_IS_TRUE(s_testVMCallback->CheckDisplayValues(wstring(L"0"), wstring(L"0")));
|
||||||
|
}
|
||||||
|
|
||||||
// Check the getter functions
|
// Check the getter functions
|
||||||
void UnitConverterTest::UnitConverterTestGetters()
|
void UnitConverterTest::UnitConverterTestGetters()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue