diff --git a/src/CalculatorUnitTests/AsyncHelper.cpp b/src/CalculatorUnitTests/AsyncHelper.cpp deleted file mode 100644 index 73937a5..0000000 --- a/src/CalculatorUnitTests/AsyncHelper.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#include "pch.h" -#include "AsyncHelper.h" -#include -#include - -using namespace std; -using namespace concurrency; -using namespace Platform; -using namespace CalculatorApp; -using namespace Windows::UI::Core; -using namespace Windows::ApplicationModel::Core; - -task AsyncHelper::RunOnUIThreadAsync(function&& action) -{ - auto callback = ref new DispatchedHandler([action]() { action(); }); - - return create_task(CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(CoreDispatcherPriority::Normal, callback)); -} - -void AsyncHelper::RunOnUIThread(function&& action, DWORD timeout) -{ - task waitTask = RunOnUIThreadAsync([action]() { action(); }); - - WaitForTask(waitTask, timeout); -} - -void AsyncHelper::Delay(DWORD milliseconds) -{ - thread timer(bind(CalculatorApp::AsyncHelper::Sleep, milliseconds)); - timer.join(); -} - -void AsyncHelper::Sleep(DWORD milliseconds) -{ - this_thread::sleep_for(chrono::milliseconds(milliseconds)); -} diff --git a/src/CalculatorUnitTests/AsyncHelper.h b/src/CalculatorUnitTests/AsyncHelper.h deleted file mode 100644 index db52809..0000000 --- a/src/CalculatorUnitTests/AsyncHelper.h +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#pragma once -#include - -namespace CalculatorApp -{ - class AsyncHelper - { - public: - static concurrency::task RunOnUIThreadAsync(std::function&& action); - static void RunOnUIThread(std::function&& action, DWORD timeout = INFINITE); - static void Delay(DWORD milliseconds); - - template - static void RunOnUIThread(std::function()>&& action, DWORD timeout = INFINITE) - { - concurrency::task t; - concurrency::task uiTask = - RunOnUIThreadAsync([&t, action]() { t = action(); }).then([&t]() { t.wait(); }, concurrency::task_continuation_context::use_arbitrary()); - - WaitForTask(uiTask, timeout); - } - - template - static bool WaitForTask(concurrency::task& t, DWORD timeout = INFINITE) - { - Microsoft::WRL::Wrappers::Event event(CreateEventEx(nullptr, nullptr, CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS)); - if (!event.IsValid()) - { - throw std::bad_alloc(); - } - - Platform::Exception ^ ex; - t.then( - [&event, &ex](concurrency::task prevTask) { - try - { - prevTask.get(); - } - catch (Platform::Exception ^ e) - { - ex = e; - } - - if (event.IsValid()) - { - SetEvent(event.Get()); - } - }, - concurrency::task_continuation_context::use_arbitrary()); - - DWORD waitResult; // = STATUS_PENDING; - waitResult = WaitForSingleObjectEx(event.Get(), timeout, true); - event.Close(); - - if (ex != nullptr) - { - throw ex; - } - - if (waitResult == WAIT_FAILED) - { - throw ref new Platform::Exception(-1, L"Error in waiting for task completion: " + waitResult.ToString()); - } - - return waitResult == WAIT_OBJECT_0; - } - - private: - static void Sleep(DWORD milliseconds); - }; -} diff --git a/src/CalculatorUnitTests/CalculatorUnitTests.rc b/src/CalculatorUnitTests/CalculatorUnitTests.rc deleted file mode 100644 index 6d28532..0000000 Binary files a/src/CalculatorUnitTests/CalculatorUnitTests.rc and /dev/null differ diff --git a/src/CalculatorUnitTests/CalculatorUnitTests.vcxproj b/src/CalculatorUnitTests/CalculatorUnitTests.vcxproj index 5c313c5..e93899d 100644 --- a/src/CalculatorUnitTests/CalculatorUnitTests.vcxproj +++ b/src/CalculatorUnitTests/CalculatorUnitTests.vcxproj @@ -207,12 +207,10 @@ - - UnitTestApp.xaml @@ -238,7 +236,6 @@ - @@ -248,7 +245,6 @@ - @@ -272,7 +268,6 @@ - @@ -288,9 +283,6 @@ Designer - - - {311e866d-8b93-4609-a691-265941fee101} @@ -302,4 +294,4 @@ - + \ No newline at end of file diff --git a/src/CalculatorUnitTests/CalculatorUnitTests.vcxproj.filters b/src/CalculatorUnitTests/CalculatorUnitTests.vcxproj.filters index 63c8bc4..dfafb3c 100644 --- a/src/CalculatorUnitTests/CalculatorUnitTests.vcxproj.filters +++ b/src/CalculatorUnitTests/CalculatorUnitTests.vcxproj.filters @@ -9,7 +9,6 @@ - @@ -17,7 +16,6 @@ - @@ -33,20 +31,15 @@ - - Mocks - - - diff --git a/src/CalculatorUnitTests/Module.cpp b/src/CalculatorUnitTests/Module.cpp deleted file mode 100644 index 825b62e..0000000 --- a/src/CalculatorUnitTests/Module.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#include "pch.h" -#include - -using namespace Microsoft::VisualStudio::CppUnitTestFramework; - -namespace CalculatorUnitTests -{ - BEGIN_TEST_MODULE_ATTRIBUTE() - TEST_MODULE_ATTRIBUTE(L"APPX:CertificateFileName", L"CalculatorUnitTests.cer:TrustedPeople") - END_TEST_MODULE_ATTRIBUTE() - - TEST_MODULE_INITIALIZE(ModuleSetup) - { - } - - TEST_MODULE_CLEANUP(ModuleCleanup) - { - } -} diff --git a/src/CalculatorUnitTests/StandardViewModelUnitTests.cpp b/src/CalculatorUnitTests/StandardViewModelUnitTests.cpp index 6a82173..e882ace 100644 --- a/src/CalculatorUnitTests/StandardViewModelUnitTests.cpp +++ b/src/CalculatorUnitTests/StandardViewModelUnitTests.cpp @@ -509,7 +509,7 @@ namespace CalculatorUnitTests VERIFY_ARE_EQUAL(Utils::GetStringValue(m_viewModel->DecimalDisplayValue), StringReference(L"15")); VERIFY_ARE_EQUAL(Utils::GetStringValue(m_viewModel->OctalDisplayValue), StringReference(L"17")); VERIFY_ARE_EQUAL(Utils::GetStringValue(m_viewModel->BinaryDisplayValue), StringReference(L"1111")); - auto val = ref new PC::Vector(64, false); + auto val = ref new Platform::Collections::Vector(64, false); val->SetAt(0, true); val->SetAt(1, true); val->SetAt(2, true); @@ -562,7 +562,7 @@ namespace CalculatorUnitTests VERIFY_ARE_EQUAL(Utils::GetStringValue(m_viewModel->DecimalDisplayValue), StringReference(L"123,456,789")); VERIFY_ARE_EQUAL(Utils::GetStringValue(m_viewModel->OctalDisplayValue), StringReference(L"726 746 425")); VERIFY_ARE_EQUAL(Utils::GetStringValue(m_viewModel->BinaryDisplayValue), StringReference(L"0111 0101 1011 1100 1101 0001 0101")); - auto val = ref new PC::Vector(64, false); + auto val = ref new Platform::Collections::Vector(64, false); val->SetAt(0, true); val->SetAt(2, true); val->SetAt(4, true); @@ -599,7 +599,7 @@ namespace CalculatorUnitTests Utils::GetStringValue(m_viewModel->BinaryDisplayValue), StringReference(L"1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1110")); VERIFY_ARE_EQUAL(m_viewModel->DisplayValue, StringReference(L"-2")); - auto val = ref new PC::Vector(64, true); + auto val = ref new Platform::Collections::Vector(64, true); val->SetAt(0, false); CompareVector(m_viewModel->BinaryDigits, val); } diff --git a/src/CalculatorUnitTests/pch.h b/src/CalculatorUnitTests/pch.h index 029bb46..b4137b2 100644 --- a/src/CalculatorUnitTests/pch.h +++ b/src/CalculatorUnitTests/pch.h @@ -48,37 +48,6 @@ #include "winrt/Windows.Globalization.DateTimeFormatting.h" #include "winrt/Windows.System.UserProfile.h" -namespace CalculatorApp -{ - namespace WF = Windows::Foundation; - namespace WUC = Windows::UI::Core; - namespace WX = Windows::UI::Xaml; - namespace WXC = Windows::UI::Xaml::Controls; - namespace WXCP = Windows::UI::Xaml::Controls::Primitives; - namespace P = Platform; - namespace PC = Platform::Collections; - namespace WXI = Windows::UI::Xaml::Input; - namespace WFC = Windows::Foundation::Collections; - namespace WS = Windows::System; - namespace WAR = Windows::ApplicationModel::Resources; - namespace WXMA = Windows::UI::Xaml::Media::Animation; - namespace WXD = Windows::UI::Xaml::Data; - namespace WXInt = Windows::UI::Xaml::Interop; - namespace WXM = Windows::UI::Xaml::Markup; - namespace WXA = Windows::UI::Xaml::Automation; -} - -// The following namespaces exist as a convenience to resolve -// ambiguity for Windows types in the Windows::UI::Xaml::Automation::Peers -// namespace that only exist on RS3. -// Once the app switches to min version RS3, the namespaces can be removed. -// TODO - MSFT 12735088 -namespace StandardPeers = Windows::UI::Xaml::Automation::Peers; -namespace CalculatorApp::Common::Automation -{ -} -namespace CustomPeers = CalculatorApp::Common::Automation; - // CalcManager Headers #include "CalcManager/ExpressionCommand.h" #include "CalcManager/CalculatorResource.h" diff --git a/src/CalculatorUnitTests/resource.h b/src/CalculatorUnitTests/resource.h deleted file mode 100644 index 12d93a3..0000000 --- a/src/CalculatorUnitTests/resource.h +++ /dev/null @@ -1,14 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by CalculatorUnitTests_VS.rc - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif