From 8359164fee11496f0bda70f133c35f9ba3db0ad3 Mon Sep 17 00:00:00 2001 From: greedyAI Date: Wed, 6 Jan 2021 19:25:27 -0800 Subject: [PATCH] Update HistoryTests.cpp --- src/CalculatorUnitTests/HistoryTests.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/CalculatorUnitTests/HistoryTests.cpp b/src/CalculatorUnitTests/HistoryTests.cpp index 5cdabbd5..5ed8a3f2 100644 --- a/src/CalculatorUnitTests/HistoryTests.cpp +++ b/src/CalculatorUnitTests/HistoryTests.cpp @@ -411,7 +411,7 @@ namespace CalculatorFunctionalTests Cleanup(); } - void HistoryStandardOrderOfOperationsHelperMultiple(int numResults, Command testCommands[]) + void HistoryStandardOrderOfOperationsHelperMultiple(String ^ expectedResults[], String ^ expectedExpressions[], int numResults, Command testCommands[]) { Initialize(); int initialSize = m_historyViewModel->ItemsCount; @@ -422,6 +422,9 @@ namespace CalculatorFunctionalTests } int sizeAfterCommandsAdd = m_historyViewModel->ItemsCount; VERIFY_ARE_EQUAL(initialSize + numResults, sizeAfterCommandsAdd); + auto historyItem = static_cast(m_historyViewModel->Items->GetAt(0)); + VERIFY_ARE_EQUAL(historyItem->Expression, expectedExpressions[0]); + VERIFY_ARE_EQUAL(historyItem->Result, expectedResults[0]); //for (int i = 0; i < numResults; i++) //{ // auto historyItem = static_cast(m_historyViewModel->Items->GetAt(i)); @@ -548,9 +551,9 @@ namespace CalculatorFunctionalTests void HistoryStandardOrderOfOperations_24() { Command commands[] = { Command::Command1, Command::CommandMUL, Command::Command2, Command::CommandMUL, Command::Command3, Command::CommandMUL, Command::Command4, Command::CommandMUL, Command::Command5, Command::CommandMUL }; - /*String ^ expectedResults[] = { L"120", L"24", L"6", L"2" }; - String ^ expectedExpressions[] = { L"24 \x00D7 5 =", L"6 \x00D7 4 =", L"2 \x00D7 3 =", L"1 \x00D7 2 =" };*/ - HistoryStandardOrderOfOperationsHelperMultiple(4, commands); + String ^ expectedResults[] = { L"120", L"24", L"6", L"2" }; + String ^ expectedExpressions[] = { L"24 \x00D7 5 =", L"6 \x00D7 4 =", L"2 \x00D7 3 =", L"1 \x00D7 2 =" }; + HistoryStandardOrderOfOperationsHelperMultiple(expectedResults, expectedExpressions, 4, commands); } };