Fixed failed unit test

This commit is contained in:
Brett Waldbaum 2019-03-08 22:57:32 -08:00
commit 8eba0a6232
4 changed files with 27 additions and 27 deletions

View file

@ -407,11 +407,11 @@ namespace CalculatorUnitTests
const UCM::Unit usdUnit = GetUnit(unitList, L"USD");
const UCM::Unit eurUnit = GetUnit(unitList, L"EUR");
VERIFY_ARE_EQUAL(StringReference(L"United States - Dollar"), ref new String(usdUnit.name.c_str()));
VERIFY_ARE_EQUAL(StringReference(L"USD"), ref new String(usdUnit.abbreviation.c_str()));
VERIFY_ARE_EQUAL(wstring(L"United States - Dollar"), usdUnit.name);
VERIFY_ARE_EQUAL(wstring(L"USD"), usdUnit.abbreviation);
VERIFY_ARE_EQUAL(StringReference(L"Europe - Euro"), ref new String(eurUnit.name.c_str()));
VERIFY_ARE_EQUAL(StringReference(L"EUR"), ref new String(eurUnit.abbreviation.c_str()));
VERIFY_ARE_EQUAL(wstring(L"Europe - Euro"), eurUnit.name);
VERIFY_ARE_EQUAL(wstring(L"EUR"), eurUnit.abbreviation);
}
TEST_METHOD(Loaded_LoadOrderedRatios)
@ -472,8 +472,8 @@ namespace CalculatorUnitTests
const pair<wstring, wstring> symbols = loader.GetCurrencySymbols(usdUnit, eurUnit);
VERIFY_ARE_EQUAL(ref new String(L"$"), StringReference(symbols.first.c_str()));
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(symbols.second.c_str()));
VERIFY_ARE_EQUAL(wstring(L"$"), symbols.first);
VERIFY_ARE_EQUAL(wstring(L"\x20ac"), symbols.second); // €
}
TEST_METHOD(Loaded_GetCurrencySymbols_Invalid)
@ -503,8 +503,8 @@ namespace CalculatorUnitTests
pair<wstring, wstring> symbols = loader.GetCurrencySymbols(fakeUnit1, fakeUnit2);
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(symbols.first.c_str()));
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(symbols.second.c_str()));
VERIFY_ARE_EQUAL(wstring(L""), wstring(symbols.first.c_str()));
VERIFY_ARE_EQUAL(wstring(L""), wstring(symbols.second.c_str()));
// Verify that when only one unit is valid, both symbols return as empty string.
vector<UCM::Unit> unitList = loader.LoadOrderedUnits(CURRENCY_CATEGORY);
@ -514,13 +514,13 @@ namespace CalculatorUnitTests
symbols = loader.GetCurrencySymbols(fakeUnit1, usdUnit);
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(symbols.first.c_str()));
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(symbols.second.c_str()));
VERIFY_ARE_EQUAL(wstring(L""), symbols.first);
VERIFY_ARE_EQUAL(wstring(L""), symbols.second);
symbols = loader.GetCurrencySymbols(usdUnit, fakeUnit1);
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(symbols.first.c_str()));
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(symbols.second.c_str()));
VERIFY_ARE_EQUAL(wstring(L""), symbols.first);
VERIFY_ARE_EQUAL(wstring(L""), symbols.second);
}
TEST_METHOD(Loaded_GetCurrencyRatioEquality_Valid)
@ -548,8 +548,8 @@ namespace CalculatorUnitTests
const pair<wstring, wstring> ratio = loader.GetCurrencyRatioEquality(usdUnit, eurUnit);
VERIFY_ARE_EQUAL(ref new String(L"1 USD = 0.9205 EUR"), StringReference(ratio.first.c_str()));
VERIFY_ARE_EQUAL(ref new String(L"1 United States Dollar = 0.9205 Europe Euro"), StringReference(ratio.second.c_str()));
VERIFY_ARE_EQUAL(wstring(L"1 USD = 0.9205 EUR"), ratio.first);
VERIFY_ARE_EQUAL(wstring(L"1 United States Dollar = 0.9205 Europe Euro"), ratio.second);
}
TEST_METHOD(Loaded_GetCurrencyRatioEquality_Invalid)
@ -578,8 +578,8 @@ namespace CalculatorUnitTests
pair<wstring, wstring> ratio = loader.GetCurrencyRatioEquality(fakeUnit1, fakeUnit2);
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(ratio.first.c_str()));
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(ratio.second.c_str()));
VERIFY_ARE_EQUAL(wstring(L""), ratio.first);
VERIFY_ARE_EQUAL(wstring(L""), ratio.second);
// Verify that when only one unit is valid, both symbols return as empty string.
vector<UCM::Unit> unitList = loader.LoadOrderedUnits(CURRENCY_CATEGORY);
@ -589,13 +589,13 @@ namespace CalculatorUnitTests
ratio = loader.GetCurrencyRatioEquality(fakeUnit1, usdUnit);
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(ratio.first.c_str()));
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(ratio.second.c_str()));
VERIFY_ARE_EQUAL(wstring(L""), ratio.first);
VERIFY_ARE_EQUAL(wstring(L""), ratio.second);
ratio = loader.GetCurrencyRatioEquality(usdUnit, fakeUnit1);
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(ratio.first.c_str()));
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(ratio.second.c_str()));
VERIFY_ARE_EQUAL(wstring(L""), ratio.first);
VERIFY_ARE_EQUAL(wstring(L""), ratio.second);
}
};
}

View file

@ -104,14 +104,14 @@ namespace CalculatorFunctionalTests
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::CommandADD);
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::Command1);
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::CommandEQU);
for (int i = 1; i < m_standardViewModel->m_standardCalculatorManager.MaxHistorySize(); i++)
for (size_t i = 1; i < m_standardViewModel->m_standardCalculatorManager.MaxHistorySize(); i++)
{
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::Command1);
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::CommandADD);
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::Command2);
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::CommandEQU);
}
VERIFY_ARE_EQUAL(m_historyViewModel->ItemSize, m_standardViewModel->m_standardCalculatorManager.MaxHistorySize());
VERIFY_ARE_EQUAL((size_t)m_historyViewModel->ItemSize, m_standardViewModel->m_standardCalculatorManager.MaxHistorySize());
String ^expression = UtfUtils::LRO + L"1 + 1 =" + UtfUtils::PDF;
int output = 2;
String ^result = output.ToString();
@ -122,7 +122,7 @@ namespace CalculatorFunctionalTests
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::CommandADD);
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::Command5);
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::CommandEQU);
VERIFY_ARE_EQUAL(m_historyViewModel->ItemSize, m_standardViewModel->m_standardCalculatorManager.MaxHistorySize());
VERIFY_ARE_EQUAL((size_t)m_historyViewModel->ItemSize, m_standardViewModel->m_standardCalculatorManager.MaxHistorySize());
expression = UtfUtils::LRO + L"1 + 2 =" + UtfUtils::PDF;
output = 3;
result = output.ToString();

View file

@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "pch.h"
@ -274,7 +274,7 @@ namespace CalculatorUnitTests
for (size_t index = 0; index < orderedModes.size(); index++)
{
ViewMode mode = orderedModes[index];
VERIFY_ARE_EQUAL(index, NavCategory::GetIndex(mode));
VERIFY_ARE_EQUAL(index, (size_t)NavCategory::GetIndex(mode));
}
VERIFY_ARE_EQUAL(-1, NavCategory::GetIndex(ViewMode::None));
@ -306,7 +306,7 @@ namespace CalculatorUnitTests
for (size_t pos = 1; pos <= orderedModes.size(); pos++)
{
ViewMode mode = orderedModes[pos - 1];
VERIFY_ARE_EQUAL(pos, NavCategory::GetPosition(mode));
VERIFY_ARE_EQUAL(pos, (size_t)NavCategory::GetPosition(mode));
}
VERIFY_ARE_EQUAL(-1, NavCategory::GetPosition(ViewMode::None));