From bfd4b8e2aec7fb61e60a26994271608b29604471 Mon Sep 17 00:00:00 2001 From: Matt Cooley Date: Thu, 22 Sep 2022 15:17:22 -0700 Subject: [PATCH] Add CalculatorApp.ViewModel and CalculatorApp.ViewModel.Tests --- src/CalcViewModel/Common/Utils.cpp | 19 -- src/CalcViewModel/Common/Utils.h | 2 - src/Calculator.sln | 92 +++++--- src/Calculator/Calculator.csproj | 4 + .../Common/KeyboardShortcutManager.cs | 2 + .../Assets/LockScreenLogo.scale-200.png | Bin 0 -> 1255 bytes .../Assets/SplashScreen.scale-200.png | Bin 0 -> 3739 bytes .../Assets/Square150x150Logo.scale-200.png | Bin 0 -> 2631 bytes .../Assets/Square44x44Logo.scale-200.png | Bin 0 -> 1408 bytes ...x44Logo.targetsize-24_altform-unplated.png | Bin 0 -> 1177 bytes .../Assets/StoreLogo.png | Bin 0 -> 1276 bytes .../Assets/Wide310x150Logo.scale-200.png | Bin 0 -> 2379 bytes .../CalculatorApp.ViewModel.Tests.csproj | 196 ++++++++++++++++++ .../Package.appxmanifest | 37 ++++ .../Properties/AssemblyInfo.cs | 13 ++ .../Properties/Default.rd.xml | 29 +++ .../UnitTestApp.xaml | 7 + .../UnitTestApp.xaml.cs | 102 +++++++++ .../UtilitiesTests.cs | 15 ++ .../CalculatorApp.ViewModel.csproj | 134 ++++++++++++ .../Common/Utilities.cs | 24 +++ .../Properties/AssemblyInfo.cs | 13 ++ .../Properties/Calculator.ViewModel.rd.xml | 33 +++ 23 files changed, 677 insertions(+), 45 deletions(-) create mode 100644 src/CalculatorApp.ViewModel.Tests/Assets/LockScreenLogo.scale-200.png create mode 100644 src/CalculatorApp.ViewModel.Tests/Assets/SplashScreen.scale-200.png create mode 100644 src/CalculatorApp.ViewModel.Tests/Assets/Square150x150Logo.scale-200.png create mode 100644 src/CalculatorApp.ViewModel.Tests/Assets/Square44x44Logo.scale-200.png create mode 100644 src/CalculatorApp.ViewModel.Tests/Assets/Square44x44Logo.targetsize-24_altform-unplated.png create mode 100644 src/CalculatorApp.ViewModel.Tests/Assets/StoreLogo.png create mode 100644 src/CalculatorApp.ViewModel.Tests/Assets/Wide310x150Logo.scale-200.png create mode 100644 src/CalculatorApp.ViewModel.Tests/CalculatorApp.ViewModel.Tests.csproj create mode 100644 src/CalculatorApp.ViewModel.Tests/Package.appxmanifest create mode 100644 src/CalculatorApp.ViewModel.Tests/Properties/AssemblyInfo.cs create mode 100644 src/CalculatorApp.ViewModel.Tests/Properties/Default.rd.xml create mode 100644 src/CalculatorApp.ViewModel.Tests/UnitTestApp.xaml create mode 100644 src/CalculatorApp.ViewModel.Tests/UnitTestApp.xaml.cs create mode 100644 src/CalculatorApp.ViewModel.Tests/UtilitiesTests.cs create mode 100644 src/CalculatorApp.ViewModel/CalculatorApp.ViewModel.csproj create mode 100644 src/CalculatorApp.ViewModel/Common/Utilities.cs create mode 100644 src/CalculatorApp.ViewModel/Properties/AssemblyInfo.cs create mode 100644 src/CalculatorApp.ViewModel/Properties/Calculator.ViewModel.rd.xml diff --git a/src/CalcViewModel/Common/Utils.cpp b/src/CalcViewModel/Common/Utils.cpp index fbc6d9e1..fdc3f6c1 100644 --- a/src/CalcViewModel/Common/Utils.cpp +++ b/src/CalcViewModel/Common/Utils.cpp @@ -47,20 +47,6 @@ double Utils::GetDoubleFromWstring(wstring input) return stod(ws); } -// Returns windowId for the current view -int Utils::GetWindowId() -{ - int windowId = -1; - - auto window = CoreWindow::GetForCurrentThread(); - if (window != nullptr) - { - windowId = ApplicationView::GetApplicationViewIdForWindow(window); - } - - return windowId; -} - void Utils::RunOnUIThreadNonblocking(std::function&& function, _In_ CoreDispatcher ^ currentDispatcher) { if (currentDispatcher != nullptr) @@ -258,11 +244,6 @@ SolidColorBrush ^ CalculatorApp::ViewModelNative::Common::Utilities::GetContrast return static_cast(Application::Current->Resources->Lookup(L"BlackBrush")); } -int CalculatorApp::ViewModelNative::Common::Utilities::GetWindowId() -{ - return Utils::GetWindowId(); -} - long long CalculatorApp::ViewModelNative::Common::Utilities::GetConst_WINEVENT_KEYWORD_RESPONSE_TIME() { return WINEVENT_KEYWORD_RESPONSE_TIME; diff --git a/src/CalcViewModel/Common/Utils.h b/src/CalcViewModel/Common/Utils.h index 121628a2..af0e8832 100644 --- a/src/CalcViewModel/Common/Utils.h +++ b/src/CalcViewModel/Common/Utils.h @@ -394,7 +394,6 @@ namespace Utils } double GetDoubleFromWstring(std::wstring input); - int GetWindowId(); void RunOnUIThreadNonblocking(std::function&& function, _In_ Windows::UI::Core::CoreDispatcher ^ currentDispatcher); Windows::Foundation::DateTime GetUniversalSystemTime(); @@ -715,7 +714,6 @@ namespace CalculatorApp static Platform::String ^ EscapeHtmlSpecialCharacters(Platform::String ^ originalString); static bool AreColorsEqual(Windows::UI::Color color1, Windows::UI::Color color2); static Windows::UI::Xaml::Media::SolidColorBrush ^ GetContrastColor(Windows::UI::Color backgroundColor); - static int GetWindowId(); static long long GetConst_WINEVENT_KEYWORD_RESPONSE_TIME(); static bool GetIntegratedDisplaySize(double* size); }; diff --git a/src/Calculator.sln b/src/Calculator.sln index 9458f929..9249a50b 100644 --- a/src/Calculator.sln +++ b/src/Calculator.sln @@ -29,6 +29,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TraceLogging", "TraceLoggin EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CalcViewModelCopyForUT", "CalcViewModelCopyForUT\CalcViewModelCopyForUT.vcxproj", "{CC9B4FA7-D746-4F52-9401-0AD1B4D6B16D}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CalculatorApp.ViewModel", "CalculatorApp.ViewModel\CalculatorApp.ViewModel.csproj", "{081F0C62-AEAC-47E8-92BC-AD6945F24192}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CalculatorApp.ViewModel.Tests", "CalculatorApp.ViewModel.Tests\CalculatorApp.ViewModel.Tests.csproj", "{3A73F66F-05D7-43CB-8E75-441D7508D943}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM = Debug|ARM @@ -41,6 +45,30 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|ARM.ActiveCfg = Debug|ARM + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|ARM.Build.0 = Debug|ARM + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|ARM.Deploy.0 = Debug|ARM + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|ARM64.Build.0 = Debug|ARM64 + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|x64.ActiveCfg = Debug|x64 + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|x64.Build.0 = Debug|x64 + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|x64.Deploy.0 = Debug|x64 + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|x86.ActiveCfg = Debug|x86 + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|x86.Build.0 = Debug|x86 + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|x86.Deploy.0 = Debug|x86 + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|ARM.ActiveCfg = Release|ARM + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|ARM.Build.0 = Release|ARM + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|ARM.Deploy.0 = Release|ARM + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|ARM64.ActiveCfg = Release|ARM64 + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|ARM64.Build.0 = Release|ARM64 + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|ARM64.Deploy.0 = Release|ARM64 + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|x64.ActiveCfg = Release|x64 + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|x64.Build.0 = Release|x64 + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|x64.Deploy.0 = Release|x64 + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|x86.ActiveCfg = Release|x86 + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|x86.Build.0 = Release|x86 + {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|x86.Deploy.0 = Release|x86 {311E866D-8B93-4609-A691-265941FEE101}.Debug|ARM.ActiveCfg = Debug|ARM {311E866D-8B93-4609-A691-265941FEE101}.Debug|ARM.Build.0 = Debug|ARM {311E866D-8B93-4609-A691-265941FEE101}.Debug|ARM64.ActiveCfg = Debug|ARM64 @@ -169,30 +197,6 @@ Global {FC81FF41-02CD-4CD9-9BC5-45A1E39AC6ED}.Release|x64.Build.0 = Release|x64 {FC81FF41-02CD-4CD9-9BC5-45A1E39AC6ED}.Release|x86.ActiveCfg = Release|Win32 {FC81FF41-02CD-4CD9-9BC5-45A1E39AC6ED}.Release|x86.Build.0 = Release|Win32 - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|ARM.ActiveCfg = Debug|ARM - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|ARM.Build.0 = Debug|ARM - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|ARM.Deploy.0 = Debug|ARM - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|ARM64.Build.0 = Debug|ARM64 - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|ARM64.Deploy.0 = Debug|ARM64 - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|x64.ActiveCfg = Debug|x64 - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|x64.Build.0 = Debug|x64 - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|x64.Deploy.0 = Debug|x64 - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|x86.ActiveCfg = Debug|x86 - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|x86.Build.0 = Debug|x86 - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Debug|x86.Deploy.0 = Debug|x86 - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|ARM.ActiveCfg = Release|ARM - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|ARM.Build.0 = Release|ARM - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|ARM.Deploy.0 = Release|ARM - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|ARM64.ActiveCfg = Release|ARM64 - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|ARM64.Build.0 = Release|ARM64 - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|ARM64.Deploy.0 = Release|ARM64 - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|x64.ActiveCfg = Release|x64 - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|x64.Build.0 = Release|x64 - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|x64.Deploy.0 = Release|x64 - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|x86.ActiveCfg = Release|x86 - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|x86.Build.0 = Release|x86 - {3B773403-B0D6-4F9A-948E-512A7A5FB315}.Release|x86.Deploy.0 = Release|x86 {CC9B4FA7-D746-4F52-9401-0AD1B4D6B16D}.Debug|ARM.ActiveCfg = Debug|ARM {CC9B4FA7-D746-4F52-9401-0AD1B4D6B16D}.Debug|ARM.Build.0 = Debug|ARM {CC9B4FA7-D746-4F52-9401-0AD1B4D6B16D}.Debug|ARM64.ActiveCfg = Debug|ARM64 @@ -207,6 +211,46 @@ Global {CC9B4FA7-D746-4F52-9401-0AD1B4D6B16D}.Release|x64.Build.0 = Release|x64 {CC9B4FA7-D746-4F52-9401-0AD1B4D6B16D}.Release|x86.ActiveCfg = Release|Win32 {CC9B4FA7-D746-4F52-9401-0AD1B4D6B16D}.Release|x86.Build.0 = Release|Win32 + {081F0C62-AEAC-47E8-92BC-AD6945F24192}.Debug|ARM.ActiveCfg = Debug|ARM + {081F0C62-AEAC-47E8-92BC-AD6945F24192}.Debug|ARM.Build.0 = Debug|ARM + {081F0C62-AEAC-47E8-92BC-AD6945F24192}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {081F0C62-AEAC-47E8-92BC-AD6945F24192}.Debug|ARM64.Build.0 = Debug|ARM64 + {081F0C62-AEAC-47E8-92BC-AD6945F24192}.Debug|x64.ActiveCfg = Debug|x64 + {081F0C62-AEAC-47E8-92BC-AD6945F24192}.Debug|x64.Build.0 = Debug|x64 + {081F0C62-AEAC-47E8-92BC-AD6945F24192}.Debug|x86.ActiveCfg = Debug|x86 + {081F0C62-AEAC-47E8-92BC-AD6945F24192}.Debug|x86.Build.0 = Debug|x86 + {081F0C62-AEAC-47E8-92BC-AD6945F24192}.Release|ARM.ActiveCfg = Release|ARM + {081F0C62-AEAC-47E8-92BC-AD6945F24192}.Release|ARM.Build.0 = Release|ARM + {081F0C62-AEAC-47E8-92BC-AD6945F24192}.Release|ARM64.ActiveCfg = Release|ARM64 + {081F0C62-AEAC-47E8-92BC-AD6945F24192}.Release|ARM64.Build.0 = Release|ARM64 + {081F0C62-AEAC-47E8-92BC-AD6945F24192}.Release|x64.ActiveCfg = Release|x64 + {081F0C62-AEAC-47E8-92BC-AD6945F24192}.Release|x64.Build.0 = Release|x64 + {081F0C62-AEAC-47E8-92BC-AD6945F24192}.Release|x86.ActiveCfg = Release|x86 + {081F0C62-AEAC-47E8-92BC-AD6945F24192}.Release|x86.Build.0 = Release|x86 + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Debug|ARM.ActiveCfg = Debug|ARM + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Debug|ARM.Build.0 = Debug|ARM + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Debug|ARM.Deploy.0 = Debug|ARM + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Debug|ARM64.Build.0 = Debug|ARM64 + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Debug|x64.ActiveCfg = Debug|x64 + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Debug|x64.Build.0 = Debug|x64 + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Debug|x64.Deploy.0 = Debug|x64 + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Debug|x86.ActiveCfg = Debug|x86 + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Debug|x86.Build.0 = Debug|x86 + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Debug|x86.Deploy.0 = Debug|x86 + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Release|ARM.ActiveCfg = Release|ARM + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Release|ARM.Build.0 = Release|ARM + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Release|ARM.Deploy.0 = Release|ARM + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Release|ARM64.ActiveCfg = Release|ARM64 + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Release|ARM64.Build.0 = Release|ARM64 + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Release|ARM64.Deploy.0 = Release|ARM64 + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Release|x64.ActiveCfg = Release|x64 + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Release|x64.Build.0 = Release|x64 + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Release|x64.Deploy.0 = Release|x64 + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Release|x86.ActiveCfg = Release|x86 + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Release|x86.Build.0 = Release|x86 + {3A73F66F-05D7-43CB-8E75-441D7508D943}.Release|x86.Deploy.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Calculator/Calculator.csproj b/src/Calculator/Calculator.csproj index f47de837..dbbb2071 100644 --- a/src/Calculator/Calculator.csproj +++ b/src/Calculator/Calculator.csproj @@ -797,6 +797,10 @@ + + {081f0c62-aeac-47e8-92bc-ad6945f24192} + CalculatorApp.ViewModel + {812d1a7b-b8ac-49e4-8e6d-af5d59500d56} CalcViewModel diff --git a/src/Calculator/Common/KeyboardShortcutManager.cs b/src/Calculator/Common/KeyboardShortcutManager.cs index f258f824..9e694775 100644 --- a/src/Calculator/Common/KeyboardShortcutManager.cs +++ b/src/Calculator/Common/KeyboardShortcutManager.cs @@ -1,8 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using CalculatorApp.ViewModel.Common; using CalculatorApp.ViewModelNative; using CalculatorApp.ViewModelNative.Common; +using Utilities = CalculatorApp.ViewModel.Common.Utilities; using System; using System.Collections.Generic; diff --git a/src/CalculatorApp.ViewModel.Tests/Assets/LockScreenLogo.scale-200.png b/src/CalculatorApp.ViewModel.Tests/Assets/LockScreenLogo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..bfd1b0db7fe89d174a867e0578d6ac7b80aad2c8 GIT binary patch literal 1255 zcmaJ>TWB0r7@l-fn_F8gYH2~8PH45-GnccoJC|e|vOBxYf}6(8mM(&l*_pGOAv>4M zOx#TUMl#7O^26Nifm?r5|-)^$EDq{mC@>Q~GmMu@N#;Ceo8SjH*h9c`K z{#cA!CY8?&kqO&HWQ2|ajpcY!kZ3Lv6(nI739-zuA_G~#N^&GDvyf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=VYgJ5K!hDF4-6{JeTV5pZu(SY@Y!)#{Y0>R}3gIX*U>aHnH>1!Mf%U zH|LL)40WCR_F<>Eu5r!nmaQ#f`r@LWm81;`o4P7LG9i*Z)faeM}o=81JOxqvJzd@MA_i595aHdLOiRy$h89rK7k4b__bYL)3-oze~?{r_rA~j zKELPrJzw`mUCoXx(-xD#V90V+IXrOnCf;--{9b!+X$&rp=#^f5mlDt;yb26uqT&aL zOX6FA2k>HN`xGcK7*bvd)q8cXdnYF-l9^BFn4?k{q78CU8kg#I>xg=^pSujdiuP`pz)G zJwQ`BQ~}l_P>=+}+}+zzLJ_jzYSj=d3g6~XgboSFy31il;f+}gi5$ZR7>b~*7$s6X zMhg}mV*`|kkre5tNWo?$Y)sP5dU$wkWt}ADB&bS~thAI<#Wsh7EMr+)rIU3ylUSFm z>AWm}r0)>)y^1C8iRCI(!0U=yuPANFE~pDCx}pV@Fj7&mTy=(@NA1 zpoaDW(WxpDvYclwvu`A0LEHK2J_n(TC~!njkeg(RlImt{#N=F zp1?T5NjjX(BCvvuVzB^0F&Ie#3+87T3nsFZ;1>ZK5CDzhkRqOFox55oc?A12v0WPs zD6EYZkl{S3aBwcq9Q)j0*f8jFl+{OPu3x*9)k|ci#(#h7##rBu_;@}xdvK;{_qO{> zUH?wcJ%6+|*D@egPsL&}Uz+`;KW|qomgk&~oX0^Y>3fmT+VAx7s^#v$Xin zo%XFa(;`Q{%=(~#`F?ozQFrFz+{ZHqnoOH#`_KMr8n?%OY|dSJ;bwkg`uV}L-{$p> zppUob#fxH-&3U%N-4}Q7FPNHdw%Yn;f8H{l`wM-=cTzwKOj z?&*p60przY({6o{da}Jo`r0>@`{g1sj) z#}89J2_LEG48tK$jI+#XJr_&L#eduF4w6aJg^)e|i%1wEzGB literal 0 HcmV?d00001 diff --git a/src/CalculatorApp.ViewModel.Tests/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/src/CalculatorApp.ViewModel.Tests/Assets/Square44x44Logo.targetsize-24_altform-un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-NNK?(#FbJCYxr*7K;8bB*m z_B_!vQ+V^Q1b&Y5bSl%|w@>uaT^j|f6BgREl4CEAHwuORp^7H{j+jIA4s{A!wUQeI z%&ZZm=!v8kC0|8vPJ(Z7&?2_qn&xkfin|y$$V|1LUmQCQQX7{X?+I@J=dlA(E2E}c zI)vr)3hCAezjL&x9bJxs*fdPs_<8l=_A^+gu$UfhawhnAg8LvoHD+zScEt34R0jaO z&Sr6Y{L`mjpXgk8y1Ej0sgIoX(nqe=*U!0*Y|FY2kC`tI+OAqBB`=Qk;Oc0wH`ts1 g`8AZ(eD=x=^-sOS4c$ivlK&gF+(OIloXUpZ0Mo+%I{*Lx literal 0 HcmV?d00001 diff --git a/src/CalculatorApp.ViewModel.Tests/CalculatorApp.ViewModel.Tests.csproj b/src/CalculatorApp.ViewModel.Tests/CalculatorApp.ViewModel.Tests.csproj new file mode 100644 index 00000000..b7d19b20 --- /dev/null +++ b/src/CalculatorApp.ViewModel.Tests/CalculatorApp.ViewModel.Tests.csproj @@ -0,0 +1,196 @@ + + + + + Debug + x86 + {3A73F66F-05D7-43CB-8E75-441D7508D943} + AppContainerExe + Properties + CalculatorApp.ViewModel.Tests + CalculatorApp.ViewModel.Tests + en-US + UAP + 10.0.22000.0 + 10.0.19041.0 + 14 + 512 + {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + $(VisualStudioVersion) + false + + + true + bin\x86\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + x86 + false + prompt + true + + + bin\x86\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + x86 + false + prompt + true + true + + + true + bin\ARM\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + ARM + false + prompt + true + + + bin\ARM\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + ARM + false + prompt + true + true + + + true + bin\ARM64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + ARM64 + false + prompt + true + true + + + bin\ARM64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + ARM64 + false + prompt + true + true + + + true + bin\x64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + x64 + false + prompt + true + + + bin\x64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + x64 + false + prompt + true + true + + + PackageReference + + + + + + + + UnitTestApp.xaml + + + + + + MSBuild:Compile + Designer + + + + + Designer + + + + + + + + + + + + + + + + + Designer + + + + + 6.2.14 + + + 2.2.10 + + + 2.2.10 + + + + + {081f0c62-aeac-47e8-92bc-ad6945f24192} + CalculatorApp.ViewModel + + + {812d1a7b-b8ac-49e4-8e6d-af5d59500d56} + CalcViewModel + + + {e727a92b-f149-492c-8117-c039a298719b} + GraphControl + + + {fc81ff41-02cd-4cd9-9bc5-45a1e39ac6ed} + TraceLogging + + + + 14.0 + + + + \ No newline at end of file diff --git a/src/CalculatorApp.ViewModel.Tests/Package.appxmanifest b/src/CalculatorApp.ViewModel.Tests/Package.appxmanifest new file mode 100644 index 00000000..4e6d4414 --- /dev/null +++ b/src/CalculatorApp.ViewModel.Tests/Package.appxmanifest @@ -0,0 +1,37 @@ + + + + + + CalculatorApp.ViewModel.Tests + Microsoft Corporation + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + diff --git a/src/CalculatorApp.ViewModel.Tests/Properties/AssemblyInfo.cs b/src/CalculatorApp.ViewModel.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..4d2c193a --- /dev/null +++ b/src/CalculatorApp.ViewModel.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,13 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("CalculatorApp.ViewModel.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyProduct("Microsoft Calculator")] +[assembly: AssemblyCopyright("Copyright © Microsoft Corporation. All rights reserved.")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: ComVisible(false)] diff --git a/src/CalculatorApp.ViewModel.Tests/Properties/Default.rd.xml b/src/CalculatorApp.ViewModel.Tests/Properties/Default.rd.xml new file mode 100644 index 00000000..996a8392 --- /dev/null +++ b/src/CalculatorApp.ViewModel.Tests/Properties/Default.rd.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/CalculatorApp.ViewModel.Tests/UnitTestApp.xaml b/src/CalculatorApp.ViewModel.Tests/UnitTestApp.xaml new file mode 100644 index 00000000..33903874 --- /dev/null +++ b/src/CalculatorApp.ViewModel.Tests/UnitTestApp.xaml @@ -0,0 +1,7 @@ + + + diff --git a/src/CalculatorApp.ViewModel.Tests/UnitTestApp.xaml.cs b/src/CalculatorApp.ViewModel.Tests/UnitTestApp.xaml.cs new file mode 100644 index 00000000..6ba8b054 --- /dev/null +++ b/src/CalculatorApp.ViewModel.Tests/UnitTestApp.xaml.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Windows.ApplicationModel; +using Windows.ApplicationModel.Activation; +using Windows.Foundation; +using Windows.Foundation.Collections; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Controls.Primitives; +using Windows.UI.Xaml.Data; +using Windows.UI.Xaml.Input; +using Windows.UI.Xaml.Media; +using Windows.UI.Xaml.Navigation; + +namespace CalculatorApp.ViewModel.Tests +{ + /// + /// Provides application-specific behavior to supplement the default Application class. + /// + sealed partial class App : Application + { + /// + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// + public App() + { + this.InitializeComponent(); + this.Suspending += OnSuspending; + } + + /// + /// Invoked when the application is launched normally by the end user. Other entry points + /// will be used such as when the application is launched to open a specific file. + /// + /// Details about the launch request and process. + protected override void OnLaunched(LaunchActivatedEventArgs e) + { + +#if DEBUG + if (System.Diagnostics.Debugger.IsAttached) + { + this.DebugSettings.EnableFrameRateCounter = true; + } +#endif + + Frame rootFrame = Window.Current.Content as Frame; + + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active + if (rootFrame == null) + { + // Create a Frame to act as the navigation context and navigate to the first page + rootFrame = new Frame(); + + rootFrame.NavigationFailed += OnNavigationFailed; + + if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) + { + //TODO: Load state from previously suspended application + } + + // Place the frame in the current Window + Window.Current.Content = rootFrame; + } + + Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.CreateDefaultUI(); + + // Ensure the current window is active + Window.Current.Activate(); + + Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.Run(e.Arguments); + } + + /// + /// Invoked when Navigation to a certain page fails + /// + /// The Frame which failed navigation + /// Details about the navigation failure + void OnNavigationFailed(object sender, NavigationFailedEventArgs e) + { + throw new Exception("Failed to load Page " + e.SourcePageType.FullName); + } + + /// + /// Invoked when application execution is being suspended. Application state is saved + /// without knowing whether the application will be terminated or resumed with the contents + /// of memory still intact. + /// + /// The source of the suspend request. + /// Details about the suspend request. + private void OnSuspending(object sender, SuspendingEventArgs e) + { + var deferral = e.SuspendingOperation.GetDeferral(); + //TODO: Save application state and stop any background activity + deferral.Complete(); + } + } +} diff --git a/src/CalculatorApp.ViewModel.Tests/UtilitiesTests.cs b/src/CalculatorApp.ViewModel.Tests/UtilitiesTests.cs new file mode 100644 index 00000000..1febd580 --- /dev/null +++ b/src/CalculatorApp.ViewModel.Tests/UtilitiesTests.cs @@ -0,0 +1,15 @@ +using CalculatorApp.ViewModel.Common; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace CalculatorApp.ViewModel.Tests +{ + [TestClass] + public class UtilitiesTests + { + [TestMethod] + public void NoCoreWindowOnThread_WindowIdIsNegative1() + { + Assert.AreEqual(-1, Utilities.GetWindowId()); + } + } +} diff --git a/src/CalculatorApp.ViewModel/CalculatorApp.ViewModel.csproj b/src/CalculatorApp.ViewModel/CalculatorApp.ViewModel.csproj new file mode 100644 index 00000000..4afeea4b --- /dev/null +++ b/src/CalculatorApp.ViewModel/CalculatorApp.ViewModel.csproj @@ -0,0 +1,134 @@ + + + + + Debug + x86 + {081F0C62-AEAC-47E8-92BC-AD6945F24192} + Library + Properties + CalculatorApp.ViewModel + CalculatorApp.ViewModel + en-US + UAP + 10.0.22000.0 + 10.0.17763.0 + 14 + 512 + {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + x86 + true + bin\x86\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + false + prompt + + + x86 + bin\x86\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + false + prompt + + + ARM + true + bin\ARM\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + false + prompt + + + ARM + bin\ARM\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + false + prompt + + + ARM64 + true + bin\ARM64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + false + prompt + + + ARM64 + bin\ARM64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + false + prompt + + + x64 + true + bin\x64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + false + prompt + + + x64 + bin\x64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + false + prompt + + + PackageReference + + + + + + + + + 6.2.14 + + + + + {812d1a7b-b8ac-49e4-8e6d-af5d59500d56} + CalcViewModel + + + {fc81ff41-02cd-4cd9-9bc5-45a1e39ac6ed} + TraceLogging + + + + 14.0 + + + + diff --git a/src/CalculatorApp.ViewModel/Common/Utilities.cs b/src/CalculatorApp.ViewModel/Common/Utilities.cs new file mode 100644 index 00000000..513fac4b --- /dev/null +++ b/src/CalculatorApp.ViewModel/Common/Utilities.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Windows.UI.Core; +using Windows.UI.ViewManagement; + +namespace CalculatorApp.ViewModel.Common +{ + public static class Utilities + { + public static int GetWindowId() + { + int windowId = -1; + + var window = CoreWindow.GetForCurrentThread(); + if (window != null) + { + windowId = ApplicationView.GetApplicationViewIdForWindow(window); + } + + return windowId; + } + } +} diff --git a/src/CalculatorApp.ViewModel/Properties/AssemblyInfo.cs b/src/CalculatorApp.ViewModel/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..c4f3ac17 --- /dev/null +++ b/src/CalculatorApp.ViewModel/Properties/AssemblyInfo.cs @@ -0,0 +1,13 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("CalculatorApp.ViewModel")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyProduct("Microsoft Calculator")] +[assembly: AssemblyCopyright("Copyright © Microsoft Corporation. All rights reserved.")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: ComVisible(false)] diff --git a/src/CalculatorApp.ViewModel/Properties/Calculator.ViewModel.rd.xml b/src/CalculatorApp.ViewModel/Properties/Calculator.ViewModel.rd.xml new file mode 100644 index 00000000..bd2ebdb4 --- /dev/null +++ b/src/CalculatorApp.ViewModel/Properties/Calculator.ViewModel.rd.xml @@ -0,0 +1,33 @@ + + + + + + + + +