Rewrite DynamicDependencies tests using TAEF (#727)

* Add TAEF to DynamicDependencies tests

* Update WIL

* Update CppWinRT to latest stable

* Initial conversion to TAEF

* Fiddling with IsolationMode to simplify some mass testing

* Removed obsolete file
This commit is contained in:
Howard Kapustein 2021-04-16 18:28:26 -07:00 коммит произвёл GitHub
Родитель eb74bec36d
Коммит 83b74cc730
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
55 изменённых файлов: 412 добавлений и 660 удалений

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\..\ProjectReunion.Build.Cpp.props" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
@ -343,15 +343,15 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets'))" />
</Target>
</Project>

Просмотреть файл

@ -337,12 +337,12 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
<Import Project="..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
</Target>
</Project>
</Project>

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\ProjectReunion.Build.Cpp.props" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
@ -430,16 +430,16 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets'))" />
</Target>
<!-- Include header files from the dev chunks -->
<Target Name="CopyFiles" AfterTargets="AfterBuild">

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\ProjectReunion.Build.Cpp.props" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
@ -359,16 +359,16 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets'))" />
</Target>
<!-- Include header files from the dev chunks -->
<Target Name="CopyFiles" AfterTargets="AfterBuild">

Просмотреть файл

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.200703.9" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.200519.2" targetFramework="native" />
</packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.210403.2" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.210204.1" targetFramework="native" />
</packages>

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props')" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
@ -351,18 +351,18 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\packages\Microsoft.Taef.10.58.210222006-develop\build\Microsoft.Taef.targets" Condition="Exists('..\..\packages\Microsoft.Taef.10.58.210222006-develop\build\Microsoft.Taef.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Taef.10.58.210222006-develop\build\Microsoft.Taef.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Taef.10.58.210222006-develop\build\Microsoft.Taef.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets'))" />
</Target>
<Target Name="CopyFiles" AfterTargets="AfterBuild">
<Copy SourceFiles="$(OutDir)\..\ProjectReunion_BootstrapDLL\Microsoft.ProjectReunion.Bootstrap.dll" DestinationFolder="$(OutDir)" />

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.200703.9" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.200519.2" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.210403.2" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.210204.1" targetFramework="native" />
<package id="Microsoft.Taef" version="10.58.210222006-develop" targetFramework="native" />
</packages>
</packages>

Просмотреть файл

@ -13,8 +13,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
void Test::DynamicDependency::Test_Win32::Create_FilePathLifetime_NoExist()
{
// Setup our dynamic dependencies
@ -34,7 +32,7 @@ void Test::DynamicDependency::Test_Win32::Create_FilePathLifetime_NoExist()
auto lifetimeArtifactFilename{ lifetimeArtifactPath / L"Test-MathAdd-LifetimeArtifact.tmp" };
std::filesystem::remove(lifetimeArtifactFilename);
auto packageDependencyId_FrameworkMathAdd{ Mdd_TryCreate_FrameworkMathAdd(HRESULT_FROM_WIN32(ERROR_CONTEXT_EXPIRED), MddPackageDependencyLifetimeKind::FilePath, lifetimeArtifactFilename.c_str()) };
Assert::IsNull(packageDependencyId_FrameworkMathAdd.get());
VERIFY_IS_NULL(packageDependencyId_FrameworkMathAdd.get());
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);

Просмотреть файл

@ -13,8 +13,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
void Test::DynamicDependency::Test_Win32::Create_RegistryLifetime_NoExist()
{
// Setup our dynamic dependencies
@ -33,7 +31,7 @@ void Test::DynamicDependency::Test_Win32::Create_RegistryLifetime_NoExist()
std::wstring lifetimeArtifactRegistryKey{ L"HKCU\\SOFTWARE\\TestProjectReunion-DynamicDependency" };
Registry_DeleteKey(lifetimeArtifactRegistryKey);
auto packageDependencyId_FrameworkMathAdd{ Mdd_TryCreate_FrameworkMathAdd(HRESULT_FROM_WIN32(ERROR_CONTEXT_EXPIRED), MddPackageDependencyLifetimeKind::RegistryKey, lifetimeArtifactRegistryKey.c_str()) };
Assert::IsNull(packageDependencyId_FrameworkMathAdd.get());
VERIFY_IS_NULL(packageDependencyId_FrameworkMathAdd.get());
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props')" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
@ -175,7 +175,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories);$(OutDir)\..\ProjectReunion_DLL</AdditionalLibraryDirectories>
<AdditionalDependencies>onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;wex.common.lib;wex.logger.lib;te.common.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>Microsoft.ProjectReunion.Bootstrap.dll;Microsoft.ProjectReunion.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
@ -196,7 +196,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories);$(OutDir)\..\ProjectReunion_DLL</AdditionalLibraryDirectories>
<AdditionalDependencies>onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;wex.common.lib;wex.logger.lib;te.common.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>Microsoft.ProjectReunion.Bootstrap.dll;Microsoft.ProjectReunion.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
@ -213,7 +213,7 @@
<Link>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories);$(OutDir)\..\ProjectReunion_DLL</AdditionalLibraryDirectories>
<AdditionalDependencies>onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;wex.common.lib;wex.logger.lib;te.common.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>Microsoft.ProjectReunion.Bootstrap.dll;Microsoft.ProjectReunion.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
@ -230,7 +230,7 @@
<Link>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories);$(OutDir)\..\ProjectReunion_DLL</AdditionalLibraryDirectories>
<AdditionalDependencies>onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;wex.common.lib;wex.logger.lib;te.common.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>Microsoft.ProjectReunion.Bootstrap.dll;Microsoft.ProjectReunion.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
@ -247,7 +247,7 @@
<Link>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories);$(OutDir)\..\ProjectReunion_DLL</AdditionalLibraryDirectories>
<AdditionalDependencies>onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;wex.common.lib;wex.logger.lib;te.common.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>Microsoft.ProjectReunion.Bootstrap.dll;Microsoft.ProjectReunion.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
@ -264,7 +264,7 @@
<Link>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories);$(OutDir)\..\ProjectReunion_DLL</AdditionalLibraryDirectories>
<AdditionalDependencies>onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;wex.common.lib;wex.logger.lib;te.common.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>Microsoft.ProjectReunion.Bootstrap.dll;Microsoft.ProjectReunion.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
@ -285,7 +285,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories);$(OutDir)\..\ProjectReunion_DLL</AdditionalLibraryDirectories>
<AdditionalDependencies>onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;wex.common.lib;wex.logger.lib;te.common.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>Microsoft.ProjectReunion.Bootstrap.dll;Microsoft.ProjectReunion.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
@ -306,7 +306,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories);$(OutDir)\..\ProjectReunion_DLL</AdditionalLibraryDirectories>
<AdditionalDependencies>onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;wex.common.lib;wex.logger.lib;te.common.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>Microsoft.ProjectReunion.Bootstrap.dll;Microsoft.ProjectReunion.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
@ -318,7 +318,6 @@
<ClCompile Include="pch.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TestCom.cpp" />
<ClCompile Include="TestFilesystem.cpp" />
<ClCompile Include="TestMddBootstrap.cpp" />
<ClCompile Include="TestPackages.cpp" />
@ -335,7 +334,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h" />
<ClInclude Include="TestCom.h" />
<ClInclude Include="TestFilesystem.h" />
<ClInclude Include="TestPackages.h" />
<ClInclude Include="Test_Win32.h" />
@ -350,15 +348,17 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\packages\Microsoft.Taef.10.58.210222006-develop\build\Microsoft.Taef.targets" Condition="Exists('..\..\..\packages\Microsoft.Taef.10.58.210222006-develop\build\Microsoft.Taef.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Taef.10.58.210222006-develop\build\Microsoft.Taef.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Taef.10.58.210222006-develop\build\Microsoft.Taef.targets'))" />
</Target>
</Project>

Просмотреть файл

@ -21,9 +21,6 @@
<ClCompile Include="TestMddBootstrap.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TestCom.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TestFilesystem.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -77,9 +74,6 @@
<ClInclude Include="pch.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="TestCom.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="TestPackages.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -93,4 +87,4 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>
</Project>

Просмотреть файл

@ -1,41 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#include "pch.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace Test::DynamicDependency::COM
{
void CoSuperInitialize(winrt::apartment_type const type)
{
// CoUninitialize() needs to be called as many times as CoInitialize()
// Keep 'peeling the onion' until we're the 1st to initialize COM
for (;;)
{
const HRESULT hr = WINRT_IMPL_CoInitializeEx(nullptr, static_cast<uint32_t>(type));
if (hr == S_OK)
{
// COM was initialized successfully on this thread
break;
}
else if (hr == S_FALSE)
{
// COM is already initialized the for thead
// Undo the init we just did and the init we just detected
WINRT_IMPL_CoUninitialize();
WINRT_IMPL_CoUninitialize();
}
else if (hr == RPC_E_CHANGED_MODE)
{
// COM is already initialized for the thread as a different apartment type
// This is an error so nothing to do. Undo the init we just detected
WINRT_IMPL_CoUninitialize();
}
else
{
Assert::AreEqual(S_OK, hr, L"Error in CoInitializeEx()");
}
}
}
}

Просмотреть файл

@ -1,7 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
namespace Test::DynamicDependency::COM
{
void CoSuperInitialize(winrt::apartment_type const type = winrt::apartment_type::multi_threaded);
}

Просмотреть файл

@ -3,8 +3,6 @@
#include "pch.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace Test::FileSystem
{
std::filesystem::path GetModulePath(HMODULE hmodule)
@ -24,7 +22,7 @@ namespace Test::FileSystem
{
wil::unique_hmodule dll(LoadLibrary(L"DynamicDependency_Test_Win32.dll"));
const auto lastError{ GetLastError() };
Assert::IsNotNull(dll.get());
VERIFY_IS_NOT_NULL(dll.get());
return GetModulePath(dll.get());
}

Просмотреть файл

@ -8,23 +8,19 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace Test::DynamicDependency
{
TEST_CLASS(BootstrapTests)
class BootstrapTests
{
public:
BEGIN_TEST_CLASS(BootstrapTests)
TEST_CLASS_PROPERTY(L"IsolationLevel", L"Method")
TEST_CLASS_PROPERTY(L"ThreadingModel", L"MTA")
//TEST_CLASS_PROPERTY(L"RunFixtureAs:Class", L"RestrictedUser")
END_TEST_CLASS()
TEST_CLASS_INITIALIZE(Setup)
TEST_CLASS_SETUP(Setup)
{
// CppUnitTest initializes COM as STA before we get called
// But we don't need (or want) STA, and we do want MTA. We can't
// stop CppUnitTest from initializing COM but we can uninitialize
// it and (re)initialize it as MTA. Don't think of it as crude
// and brutish but rather 'thinking outside the box'...
COM::CoSuperInitialize();
// We need to find Microsoft.ProjectReunion.Bootstrap.dll.
// Normally it's colocated with the application (i.e. same dir as the exe)
// but that's not true of our test project (a dll) in our build environment
@ -33,7 +29,7 @@ namespace Test::DynamicDependency
auto bootstrapDllAbsoluteFilename{ TF::GetBootstrapAbsoluteFilename() };
wil::unique_hmodule bootstrapDll(LoadLibrary(bootstrapDllAbsoluteFilename.c_str()));
const auto lastError{ GetLastError() };
Assert::IsNotNull(bootstrapDll.get());
VERIFY_IS_NOT_NULL(bootstrapDll.get());
TP::RemovePackage_DynamicDependencyLifetimeManager();
TP::RemovePackage_ProjectReunionFramework();
@ -41,6 +37,8 @@ namespace Test::DynamicDependency
TP::AddPackage_DynamicDependencyLifetimeManager();
m_bootstrapDll = std::move(bootstrapDll);
return true;
}
TEST_CLASS_CLEANUP(Cleanup)
@ -50,37 +48,34 @@ namespace Test::DynamicDependency
TP::RemovePackage_DynamicDependencyLifetimeManager();
TP::RemovePackage_ProjectReunionFramework();
// Undo COM::CoSuperInitialize() and restore the thread to its initial state
// as when CppUnitTest called us. Or as close as we can get to it
winrt::uninit_apartment();
winrt::init_apartment(winrt::apartment_type::single_threaded);
return true;
}
TEST_METHOD(Initialize_DDLMNotFound)
{
Assert::AreEqual(S_OK, MddBootstrapTestInitialize(Test::Packages::DynamicDependencyLifetimeManager::c_PackageNamePrefix, Test::Packages::DynamicDependencyLifetimeManager::c_PackagePublisherId));
VERIFY_ARE_EQUAL(S_OK, MddBootstrapTestInitialize(Test::Packages::DynamicDependencyLifetimeManager::c_PackageNamePrefix, Test::Packages::DynamicDependencyLifetimeManager::c_PackagePublisherId));
// Version 0.0.0.0 == Major version 0 == No such framework package
const PACKAGE_VERSION doesNotExist{};
Assert::AreEqual(HRESULT_FROM_WIN32(ERROR_NO_MATCH), MddBootstrapInitialize(doesNotExist));
VERIFY_ARE_EQUAL(HRESULT_FROM_WIN32(ERROR_NO_MATCH), MddBootstrapInitialize(doesNotExist));
}
TEST_METHOD(Initialize_DDLMMinVersionNoMatch)
{
Assert::AreEqual(S_OK, MddBootstrapTestInitialize(Test::Packages::DynamicDependencyLifetimeManager::c_PackageNamePrefix, Test::Packages::DynamicDependencyLifetimeManager::c_PackagePublisherId));
VERIFY_ARE_EQUAL(S_OK, MddBootstrapTestInitialize(Test::Packages::DynamicDependencyLifetimeManager::c_PackageNamePrefix, Test::Packages::DynamicDependencyLifetimeManager::c_PackagePublisherId));
// Version <major>.65535.65535.65535 to find framework packages for the major version but none meeting this minVersion criteria
PACKAGE_VERSION minVersionNoMatch{ static_cast<UINT64>(Test::Packages::DynamicDependencyLifetimeManager::c_Version.Major) << 48 | 0x0000FFFFFFFFFFFFuI64 };
Assert::AreEqual(HRESULT_FROM_WIN32(ERROR_NO_MATCH), MddBootstrapInitialize(minVersionNoMatch));
VERIFY_ARE_EQUAL(HRESULT_FROM_WIN32(ERROR_NO_MATCH), MddBootstrapInitialize(minVersionNoMatch));
}
TEST_METHOD(Initialize)
{
Assert::AreEqual(S_OK, MddBootstrapTestInitialize(Test::Packages::DynamicDependencyLifetimeManager::c_PackageNamePrefix, Test::Packages::DynamicDependencyLifetimeManager::c_PackagePublisherId));
VERIFY_ARE_EQUAL(S_OK, MddBootstrapTestInitialize(Test::Packages::DynamicDependencyLifetimeManager::c_PackageNamePrefix, Test::Packages::DynamicDependencyLifetimeManager::c_PackagePublisherId));
// Version <major>.0.0.0 to find any framework package for this major version
PACKAGE_VERSION minVersion{ static_cast<UINT64>(Test::Packages::DynamicDependencyLifetimeManager::c_Version.Major) << 48 };
Assert::AreEqual(S_OK, MddBootstrapInitialize(minVersion));
VERIFY_ARE_EQUAL(S_OK, MddBootstrapInitialize(minVersion));
MddBootstrapShutdown();
}
@ -96,27 +91,27 @@ namespace Test::DynamicDependency
const UINT32 c_filter{ PACKAGE_FILTER_HEAD | PACKAGE_FILTER_DIRECT | PACKAGE_FILTER_STATIC | PACKAGE_FILTER_DYNAMIC | PACKAGE_INFORMATION_BASIC };
{
Assert::AreEqual(E_INVALIDARG, HRESULT_FROM_WIN32(::GetCurrentPackageInfo(c_filter, nullptr, nullptr, nullptr)));
VERIFY_ARE_EQUAL(E_INVALIDARG, HRESULT_FROM_WIN32(::GetCurrentPackageInfo(c_filter, nullptr, nullptr, nullptr)));
}
{
UINT32 count{};
Assert::AreEqual(E_INVALIDARG, HRESULT_FROM_WIN32(::GetCurrentPackageInfo(c_filter, nullptr, nullptr, &count)));
VERIFY_ARE_EQUAL(E_INVALIDARG, HRESULT_FROM_WIN32(::GetCurrentPackageInfo(c_filter, nullptr, nullptr, &count)));
}
{
UINT32 bufferLength{ 1 };
Assert::AreEqual(E_INVALIDARG, HRESULT_FROM_WIN32(::GetCurrentPackageInfo(c_filter, &bufferLength, nullptr, nullptr)));
VERIFY_ARE_EQUAL(E_INVALIDARG, HRESULT_FROM_WIN32(::GetCurrentPackageInfo(c_filter, &bufferLength, nullptr, nullptr)));
}
{
UINT32 bufferLength{ 1 };
UINT32 count{};
Assert::AreEqual(E_INVALIDARG, HRESULT_FROM_WIN32(::GetCurrentPackageInfo(c_filter, &bufferLength, nullptr, &count)));
VERIFY_ARE_EQUAL(E_INVALIDARG, HRESULT_FROM_WIN32(::GetCurrentPackageInfo(c_filter, &bufferLength, nullptr, &count)));
}
{
BYTE buffer[1]{};
UINT32 bufferLength{ static_cast<UINT32>(ARRAYSIZE(buffer)) };
Assert::AreEqual(E_INVALIDARG, HRESULT_FROM_WIN32(::GetCurrentPackageInfo(c_filter, &bufferLength, buffer, nullptr)));
VERIFY_ARE_EQUAL(E_INVALIDARG, HRESULT_FROM_WIN32(::GetCurrentPackageInfo(c_filter, &bufferLength, buffer, nullptr)));
}
}
@ -127,11 +122,11 @@ namespace Test::DynamicDependency
winrt::hstring packageFamilyName{ Test::Packages::DynamicDependencyLifetimeManager::c_PackageFamilyName };
auto applicationData{ winrt::Windows::Management::Core::ApplicationDataManager::CreateForPackageFamily(packageFamilyName) };
Assert::AreEqual(S_OK, MddBootstrapTestInitialize(Test::Packages::DynamicDependencyLifetimeManager::c_PackageNamePrefix, Test::Packages::DynamicDependencyLifetimeManager::c_PackagePublisherId));
VERIFY_ARE_EQUAL(S_OK, MddBootstrapTestInitialize(Test::Packages::DynamicDependencyLifetimeManager::c_PackageNamePrefix, Test::Packages::DynamicDependencyLifetimeManager::c_PackagePublisherId));
// Version <major>.0.0.0 to find any framework package for this major version
PACKAGE_VERSION minVersion{ static_cast<UINT64>(Test::Packages::DynamicDependencyLifetimeManager::c_Version.Major) << 48 };
Assert::AreEqual(S_OK, MddBootstrapInitialize(minVersion));
VERIFY_ARE_EQUAL(S_OK, MddBootstrapInitialize(minVersion));
VerifyGetCurrentPackageInfo(HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), 1, 700);
@ -150,11 +145,11 @@ namespace Test::DynamicDependency
winrt::hstring packageFamilyName{ Test::Packages::DynamicDependencyLifetimeManager::c_PackageFamilyName };
auto applicationData{ winrt::Windows::Management::Core::ApplicationDataManager::CreateForPackageFamily(packageFamilyName) };
Assert::AreEqual(S_OK, MddBootstrapTestInitialize(Test::Packages::DynamicDependencyLifetimeManager::c_PackageNamePrefix, Test::Packages::DynamicDependencyLifetimeManager::c_PackagePublisherId));
VERIFY_ARE_EQUAL(S_OK, MddBootstrapTestInitialize(Test::Packages::DynamicDependencyLifetimeManager::c_PackageNamePrefix, Test::Packages::DynamicDependencyLifetimeManager::c_PackagePublisherId));
// Version <major>.0.0.0 to find any framework package for this major version
PACKAGE_VERSION minVersion{ static_cast<UINT64>(Test::Packages::DynamicDependencyLifetimeManager::c_Version.Major) << 48 };
Assert::AreEqual(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED), MddBootstrapInitialize(minVersion));
VERIFY_ARE_EQUAL(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED), MddBootstrapInitialize(minVersion));
VerifyGetCurrentPackageInfo();
}
@ -168,16 +163,16 @@ namespace Test::DynamicDependency
{
UINT32 bufferLength{};
UINT32 count{};
Assert::AreEqual(expectedHR, HRESULT_FROM_WIN32(::GetCurrentPackageInfo(PACKAGE_FILTER_HEAD | PACKAGE_FILTER_DIRECT | PACKAGE_FILTER_STATIC | PACKAGE_FILTER_DYNAMIC | PACKAGE_INFORMATION_BASIC, &bufferLength, nullptr, &count)));
Assert::AreEqual(expectedCount, count);
VERIFY_ARE_EQUAL(expectedHR, HRESULT_FROM_WIN32(::GetCurrentPackageInfo(PACKAGE_FILTER_HEAD | PACKAGE_FILTER_DIRECT | PACKAGE_FILTER_STATIC | PACKAGE_FILTER_DYNAMIC | PACKAGE_INFORMATION_BASIC, &bufferLength, nullptr, &count)));
VERIFY_ARE_EQUAL(expectedCount, count);
if (minExpectedBufferLength > 0)
{
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"GetCurrentPackageInfo() expectedBufferLength>=%u bufferLength=%u", minExpectedBufferLength, bufferLength) };
Assert::IsTrue(bufferLength >= minExpectedBufferLength, message.get());
VERIFY_IS_TRUE(bufferLength >= minExpectedBufferLength, message.get());
}
else
{
Assert::AreEqual(0u, bufferLength);
VERIFY_ARE_EQUAL(0u, bufferLength);
}
}

Просмотреть файл

@ -3,8 +3,6 @@
#include "pch.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace TF = ::Test::FileSystem;
namespace Test::Packages
@ -36,7 +34,7 @@ namespace Test::Packages
msix /= packageDirName;
msix /= packageDirName;
msix += L".msix";
Assert::IsTrue(std::filesystem::is_regular_file(msix));
VERIFY_IS_TRUE(std::filesystem::is_regular_file(msix));
}
auto msixUri = winrt::Windows::Foundation::Uri(msix.c_str());
@ -47,7 +45,7 @@ namespace Test::Packages
if (FAILED(deploymentResult.ExtendedErrorCode()))
{
auto message = wil::str_printf<wil::unique_process_heap_string>(L"AddPackageAsync('%s') = 0x%0X %s", packageFullName, deploymentResult.ExtendedErrorCode(), deploymentResult.ErrorText().c_str());
Assert::Fail(message.get());
VERIFY_FAIL(message.get());
}
}
@ -66,7 +64,7 @@ namespace Test::Packages
if (!deploymentResult)
{
auto message = wil::str_printf<wil::unique_process_heap_string>(L"RemovePackageAsync('%s') = 0x%0X %s", packageFullName, deploymentResult.ExtendedErrorCode(), deploymentResult.ErrorText().c_str());
Assert::Fail(message.get());
VERIFY_FAIL(message.get());
}
}
@ -88,9 +86,9 @@ namespace Test::Packages
return std::wstring();
}
Assert::AreEqual(ERROR_INSUFFICIENT_BUFFER, rc);
VERIFY_ARE_EQUAL(ERROR_INSUFFICIENT_BUFFER, rc);
auto path = wil::make_process_heap_string(nullptr, pathLength);
Assert::AreEqual(ERROR_SUCCESS, GetPackagePathByFullName(packageFullName, &pathLength, path.get()));
VERIFY_ARE_EQUAL(ERROR_SUCCESS, GetPackagePathByFullName(packageFullName, &pathLength, path.get()));
return std::wstring(path.get());
}

Просмотреть файл

@ -6,8 +6,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
inline DWORD WIN32_FROM_HRESULT(const HRESULT hr)
{
return HRESULT_FACILITY(hr) == FACILITY_WIN32 ? HRESULT_CODE(hr) : hr;
@ -15,19 +13,17 @@ inline DWORD WIN32_FROM_HRESULT(const HRESULT hr)
namespace Test::DynamicDependency
{
TEST_CLASS(GetCurrentPackageInfoTests)
class GetCurrentPackageInfoTests
{
public:
BEGIN_TEST_CLASS(GetCurrentPackageInfoTests)
//TEST_CLASS_PROPERTY(L"IsolationLevel", L"Method")
TEST_CLASS_PROPERTY(L"ThreadingModel", L"MTA")
//TEST_CLASS_PROPERTY(L"RunFixtureAs:Class", L"RestrictedUser")
END_TEST_CLASS()
TEST_CLASS_INITIALIZE(Setup)
TEST_CLASS_SETUP(Setup)
{
// CppUnitTest initializes COM as STA before we get called
// But we don't need (or want) STA, and we do want MTA. We can't
// stop CppUnitTest from initializing COM but we can uninitialize
// it and (re)initialize it as MTA. Don't think of it as crude
// and brutish but rather 'thinking outside the box'...
COM::CoSuperInitialize();
TP::RemovePackage_DynamicDependencyLifetimeManager();
TP::RemovePackage_ProjectReunionFramework();
TP::RemovePackage_FrameworkMathAdd();
@ -42,10 +38,12 @@ namespace Test::DynamicDependency
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, dllAbsoluteFilename.c_str()) };
Assert::IsNotNull(dll.get(), message.get());
VERIFY_IS_NOT_NULL(dll.get(), message.get());
}
m_dll = std::move(dll);
return true;
}
TEST_CLASS_CLEANUP(Cleanup)
@ -56,10 +54,7 @@ namespace Test::DynamicDependency
TP::RemovePackage_ProjectReunionFramework();
TP::RemovePackage_FrameworkMathAdd();
// Undo COM::CoSuperInitialize() and restore the thread to its initial state
// as when CppUnitTest called us. Or as close as we can get to it
winrt::uninit_apartment();
winrt::init_apartment(winrt::apartment_type::single_threaded);
return true;
}
TEST_METHOD(Unpackaged_PackageGraph0)
@ -108,14 +103,14 @@ namespace Test::DynamicDependency
PCWSTR lifetimeArtifact{};
const MddCreatePackageDependencyOptions createOptions{};
wil::unique_process_heap_string packageDependencyId_FrameworkMathAdd;
Assert::AreEqual(S_OK, MddTryCreatePackageDependency(nullptr, TP::FrameworkMathAdd::c_PackageFamilyName, minVersion, architectures, lifetimeKind, lifetimeArtifact, createOptions, &packageDependencyId_FrameworkMathAdd));
VERIFY_ARE_EQUAL(S_OK, MddTryCreatePackageDependency(nullptr, TP::FrameworkMathAdd::c_PackageFamilyName, minVersion, architectures, lifetimeKind, lifetimeArtifact, createOptions, &packageDependencyId_FrameworkMathAdd));
// -- Add
const auto rank{ MDD_PACKAGE_DEPENDENCY_RANK_DEFAULT };
const MddAddPackageDependencyOptions addOptions{};
MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext_FrameworkMathAdd{};
wil::unique_process_heap_string packageFullName_FrameworkMathAdd;
Assert::AreEqual(S_OK, MddAddPackageDependency(packageDependencyId_FrameworkMathAdd.get(), rank, addOptions, &packageDependencyContext_FrameworkMathAdd, &packageFullName_FrameworkMathAdd));
VERIFY_ARE_EQUAL(S_OK, MddAddPackageDependency(packageDependencyId_FrameworkMathAdd.get(), rank, addOptions, &packageDependencyContext_FrameworkMathAdd, &packageFullName_FrameworkMathAdd));
// Verify GetCurrentPackageInfo*()
PrintGetCurrentPackageInfoHeader();
@ -171,9 +166,9 @@ namespace Test::DynamicDependency
UINT32 count{};
const auto rc{ GetCurrentPackageInfo(flags, &bufferSize, nullptr, &count) };
PrintGetCurrentPackageInfoN(L"GetCurrentPackageInfo ", flags, rc, bufferSize, count, expectedRC, minExpectedBufferSize, expectedCount);
Assert::AreEqual(expectedRC, rc);
Assert::IsTrue(minExpectedBufferSize <= bufferSize);
Assert::AreEqual(expectedCount, count);
VERIFY_ARE_EQUAL(expectedRC, rc);
VERIFY_IS_TRUE(minExpectedBufferSize <= bufferSize);
VERIFY_ARE_EQUAL(expectedCount, count);
}
void VerifyGetCurrentPackageInfo2(
@ -188,9 +183,9 @@ namespace Test::DynamicDependency
UINT32 count{};
const auto rc{ GetCurrentPackageInfo2(flags, packagePathType, &bufferSize, nullptr, &count) };
PrintGetCurrentPackageInfoN(L"GetCurrentPackageInfo2", flags, rc, bufferSize, count, expectedRC, minExpectedBufferSize, expectedCount);
Assert::AreEqual(expectedRC, rc);
Assert::IsTrue(minExpectedBufferSize <= bufferSize);
Assert::AreEqual(expectedCount, count);
VERIFY_ARE_EQUAL(expectedRC, rc);
VERIFY_IS_TRUE(minExpectedBufferSize <= bufferSize);
VERIFY_ARE_EQUAL(expectedCount, count);
}
void VerifyGetCurrentPackageInfo3(
@ -209,9 +204,9 @@ namespace Test::DynamicDependency
UINT32 count{};
const auto hr{ m_getCurrentPackageInfo3(flags, packageInfoType, &bufferSize, nullptr, &count) };
PrintGetCurrentPackageInfoN(L"GetCurrentPackageInfo3", flags, hr, bufferSize, count, expectedHR, minExpectedBufferSize, expectedCount);
Assert::AreEqual(expectedHR, hr);
Assert::IsTrue(minExpectedBufferSize <= bufferSize);
Assert::AreEqual(expectedCount, count);
VERIFY_ARE_EQUAL(expectedHR, hr);
VERIFY_IS_TRUE(minExpectedBufferSize <= bufferSize);
VERIFY_ARE_EQUAL(expectedCount, count);
}
void VerifyGetCurrentPackageInfo123(
@ -243,16 +238,16 @@ namespace Test::DynamicDependency
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Get...GenerationId: hr:0x%X id:%u\n"
L" Expected: hr:0x%X id:%u",
hr, generationId, expectedHR, expectedGenerationId) };
Assert::IsTrue(true, message.get());
VERIFY_IS_TRUE(true, message.get());
OutputDebugStringW(message.get());
Assert::AreEqual(expectedHR, hr);
Assert::AreEqual(expectedGenerationId, generationId);
VERIFY_ARE_EQUAL(expectedHR, hr);
VERIFY_ARE_EQUAL(expectedGenerationId, generationId);
}
void PrintGetCurrentPackageInfoHeader()
{
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"%-10s %5s %7s %s\n", L"ErrorCode", L"Count", L"BufSize", L"Function") };
Assert::IsTrue(true, message.get());
VERIFY_IS_TRUE(true, message.get());
OutputDebugStringW(message.get());
}
@ -323,7 +318,7 @@ namespace Test::DynamicDependency
}
}
message += L"\n";
Assert::IsTrue(true, message.c_str());
VERIFY_IS_TRUE(true, message.c_str());
OutputDebugStringW(message.c_str());
}

Просмотреть файл

@ -11,23 +11,19 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace Test::DynamicDependency
{
TEST_CLASS(LifetimeManagementTests)
class LifetimeManagementTests
{
public:
BEGIN_TEST_CLASS(LifetimeManagementTests)
TEST_CLASS_PROPERTY(L"IsolationLevel", L"Method")
TEST_CLASS_PROPERTY(L"ThreadingModel", L"MTA")
//TEST_CLASS_PROPERTY(L"RunFixtureAs:Class", L"RestrictedUser")
END_TEST_CLASS()
TEST_CLASS_INITIALIZE(Setup)
TEST_CLASS_SETUP(Setup)
{
// CppUnitTest initializes COM as STA before we get called
// But we don't need (or want) STA, and we do want MTA. We can't
// stop CppUnitTest from initializing COM but we can uninitialize
// it and (re)initialize it as MTA. Don't think of it as crude
// and brutish but rather 'thinking outside the box'...
COM::CoSuperInitialize();
// We need to find Microsoft.ProjectReunion.Bootstrap.dll.
// Normally it's colocated with the application (i.e. same dir as the exe)
// but that's not true of our test project (a dll) in our build environment
@ -36,7 +32,7 @@ namespace Test::DynamicDependency
auto bootstrapDllAbsoluteFilename{ TF::GetBootstrapAbsoluteFilename() };
wil::unique_hmodule bootstrapDll(LoadLibrary(bootstrapDllAbsoluteFilename.c_str()));
const auto lastError{ GetLastError() };
Assert::IsNotNull(bootstrapDll.get());
VERIFY_IS_NOT_NULL(bootstrapDll.get());
TP::RemovePackage_DynamicDependencyLifetimeManager();
TP::RemovePackage_ProjectReunionFramework();
@ -45,13 +41,15 @@ namespace Test::DynamicDependency
m_bootstrapDll = std::move(bootstrapDll);
Assert::AreEqual(S_OK, MddBootstrapTestInitialize(Test::Packages::DynamicDependencyLifetimeManager::c_PackageNamePrefix, Test::Packages::DynamicDependencyLifetimeManager::c_PackagePublisherId));
VERIFY_ARE_EQUAL(S_OK, MddBootstrapTestInitialize(Test::Packages::DynamicDependencyLifetimeManager::c_PackageNamePrefix, Test::Packages::DynamicDependencyLifetimeManager::c_PackagePublisherId));
// Version <major>.0.0.0 to find any framework package for this major version
PACKAGE_VERSION minVersion{ static_cast<UINT64>(Test::Packages::DynamicDependencyLifetimeManager::c_Version.Major) << 48 };
Assert::AreEqual(S_OK, MddBootstrapInitialize(minVersion));
VERIFY_ARE_EQUAL(S_OK, MddBootstrapInitialize(minVersion));
Assert::AreEqual(S_OK, MddLifetimeManagementTestInitialize(Test::Packages::DynamicDependencyLifetimeManagerGC::c_PackageNamePrefix, Test::Packages::DynamicDependencyLifetimeManagerGC::c_PackagePublisherId));
VERIFY_ARE_EQUAL(S_OK, MddLifetimeManagementTestInitialize(Test::Packages::DynamicDependencyLifetimeManagerGC::c_PackageNamePrefix, Test::Packages::DynamicDependencyLifetimeManagerGC::c_PackagePublisherId));
return true;
}
TEST_CLASS_CLEANUP(Cleanup)
@ -65,7 +63,7 @@ namespace Test::DynamicDependency
TP::RemovePackage_DynamicDependencyLifetimeManager();
TP::RemovePackage_ProjectReunionFramework();
winrt::uninit_apartment();
return true;
}
TEST_METHOD(GC_Found0)
@ -73,13 +71,13 @@ namespace Test::DynamicDependency
TP::RemovePackage_DynamicDependencyLifetimeManagerGC1000();
TP::RemovePackage_DynamicDependencyLifetimeManagerGC1010();
Assert::IsFalse(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1000::c_PackageFullName));
Assert::IsFalse(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1010::c_PackageFullName));
VERIFY_IS_FALSE(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1000::c_PackageFullName));
VERIFY_IS_FALSE(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1010::c_PackageFullName));
Assert::AreEqual(S_OK, MddLifetimeManagementGC());
VERIFY_ARE_EQUAL(S_OK, MddLifetimeManagementGC());
Assert::IsFalse(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1000::c_PackageFullName));
Assert::IsFalse(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1010::c_PackageFullName));
VERIFY_IS_FALSE(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1000::c_PackageFullName));
VERIFY_IS_FALSE(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1010::c_PackageFullName));
}
TEST_METHOD(GC_Found1)
@ -87,13 +85,13 @@ namespace Test::DynamicDependency
TP::AddPackageIfNecessary_DynamicDependencyLifetimeManagerGC1000();
TP::RemovePackage_DynamicDependencyLifetimeManagerGC1010();
Assert::IsTrue(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1000::c_PackageFullName));
Assert::IsFalse(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1010::c_PackageFullName));
VERIFY_IS_TRUE(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1000::c_PackageFullName));
VERIFY_IS_FALSE(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1010::c_PackageFullName));
Assert::AreEqual(S_OK, MddLifetimeManagementGC());
VERIFY_ARE_EQUAL(S_OK, MddLifetimeManagementGC());
Assert::IsTrue(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1000::c_PackageFullName));
Assert::IsFalse(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1010::c_PackageFullName));
VERIFY_IS_TRUE(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1000::c_PackageFullName));
VERIFY_IS_FALSE(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1010::c_PackageFullName));
}
TEST_METHOD(GC_Found2)
@ -101,13 +99,13 @@ namespace Test::DynamicDependency
TP::AddPackageIfNecessary_DynamicDependencyLifetimeManagerGC1000();
TP::AddPackageIfNecessary_DynamicDependencyLifetimeManagerGC1010();
Assert::IsTrue(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1000::c_PackageFullName));
Assert::IsTrue(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1010::c_PackageFullName));
VERIFY_IS_TRUE(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1000::c_PackageFullName));
VERIFY_IS_TRUE(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1010::c_PackageFullName));
Assert::AreEqual(S_OK, MddLifetimeManagementGC());
VERIFY_ARE_EQUAL(S_OK, MddLifetimeManagementGC());
Assert::IsFalse(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1000::c_PackageFullName));
Assert::IsTrue(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1010::c_PackageFullName));
VERIFY_IS_FALSE(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1000::c_PackageFullName));
VERIFY_IS_TRUE(TP::IsPackageRegistered(Test::Packages::DynamicDependencyLifetimeManagerGC1010::c_PackageFullName));
}
private:

Просмотреть файл

@ -13,19 +13,10 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
wil::unique_hmodule Test::DynamicDependency::Test_Win32::m_bootstrapDll;
void Test::DynamicDependency::Test_Win32::Setup()
bool Test::DynamicDependency::Test_Win32::Setup()
{
// CppUnitTest initializes COM as STA before we get called
// But we don't need (or want) STA, and we do want MTA. We can't
// stop CppUnitTest from initializing COM but we can uninitialize
// it and (re)initialize it as MTA. Don't think of it as crude
// and brutish but rather 'thinking outside the box'...
COM::CoSuperInitialize();
// Remove our packages in case they were previously installed and incompletely removed
TP::RemovePackage_DynamicDependencyLifetimeManager();
TP::RemovePackage_DynamicDependencyDataStore();
@ -50,19 +41,21 @@ void Test::DynamicDependency::Test_Win32::Setup()
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, bootstrapDllAbsoluteFilename.c_str()) };
Assert::IsNotNull(bootstrapDll.get(), message.get());
VERIFY_IS_NOT_NULL(bootstrapDll.get(), message.get());
}
Assert::AreEqual(S_OK, MddBootstrapTestInitialize(Test::Packages::DynamicDependencyLifetimeManager::c_PackageNamePrefix, Test::Packages::DynamicDependencyLifetimeManager::c_PackagePublisherId));
VERIFY_ARE_EQUAL(S_OK, MddBootstrapTestInitialize(Test::Packages::DynamicDependencyLifetimeManager::c_PackageNamePrefix, Test::Packages::DynamicDependencyLifetimeManager::c_PackagePublisherId));
// Version <major>.0.0.0 to find any framework package for this major version
PACKAGE_VERSION minVersion{ static_cast<UINT64>(Test::Packages::DynamicDependencyLifetimeManager::c_Version.Major) << 48 };
Assert::AreEqual(S_OK, MddBootstrapInitialize(minVersion));
VERIFY_ARE_EQUAL(S_OK, MddBootstrapInitialize(minVersion));
m_bootstrapDll = std::move(bootstrapDll);
return true;
}
void Test::DynamicDependency::Test_Win32::Cleanup()
bool Test::DynamicDependency::Test_Win32::Cleanup()
{
MddBootstrapShutdown();
@ -74,10 +67,7 @@ void Test::DynamicDependency::Test_Win32::Cleanup()
TP::RemovePackage_FrameworkMathMultiply();
TP::RemovePackage_FrameworkMathAdd();
// Undo COM::CoSuperInitialize() and restore the thread to its initial state
// as when CppUnitTest called us. Or as close as we can get to it
winrt::uninit_apartment();
winrt::init_apartment(winrt::apartment_type::single_threaded);
return true;
}
void Test::DynamicDependency::Test_Win32::Create_Delete()
@ -89,7 +79,7 @@ void Test::DynamicDependency::Test_Win32::Create_Delete()
PCWSTR lifetimeArtifact{};
const MddCreatePackageDependencyOptions options{};
wil::unique_process_heap_string packageDependencyId;
Assert::AreEqual(S_OK, MddTryCreatePackageDependency(nullptr, packageFamilyName, minVersion, architectureFilter, lifetimeKind, lifetimeArtifact, options, &packageDependencyId));
VERIFY_ARE_EQUAL(S_OK, MddTryCreatePackageDependency(nullptr, packageFamilyName, minVersion, architectureFilter, lifetimeKind, lifetimeArtifact, options, &packageDependencyId));
MddDeletePackageDependency(packageDependencyId.get());
}
@ -132,9 +122,9 @@ void Test::DynamicDependency::Test_Win32::FullLifecycle_ProcessLifetime_Framewor
wil::unique_process_heap_string packageFullName_FrameworkMathAdd;
MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext_FrameworkMathAdd{ Mdd_Add(packageDependencyId_FrameworkMathAdd.get(), packageFullName_FrameworkMathAdd) };
Assert::IsNotNull(packageFullName_FrameworkMathAdd.get());
VERIFY_IS_NOT_NULL(packageFullName_FrameworkMathAdd.get());
std::wstring actualPackageFullName_FrameworkMathAdd{ packageFullName_FrameworkMathAdd.get() };
Assert::AreEqual(actualPackageFullName_FrameworkMathAdd, expectedPackageFullName_FrameworkMathAdd);
VERIFY_ARE_EQUAL(actualPackageFullName_FrameworkMathAdd, expectedPackageFullName_FrameworkMathAdd);
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -150,18 +140,18 @@ void Test::DynamicDependency::Test_Win32::FullLifecycle_ProcessLifetime_Framewor
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, projectReunionDllFilename) };
Assert::IsNotNull(projectReunionDll.get(), message.get());
VERIFY_IS_NOT_NULL(projectReunionDll.get(), message.get());
}
auto mddGetResolvedPackageFullNameForPackageDependency{ GetProcAddressByFunctionDeclaration(projectReunionDll.get(), MddGetResolvedPackageFullNameForPackageDependency) };
Assert::IsNotNull(mddGetResolvedPackageFullNameForPackageDependency);
VERIFY_IS_NOT_NULL(mddGetResolvedPackageFullNameForPackageDependency);
wil::unique_process_heap_string resolvedPackageFullName;
Assert::AreEqual(S_OK, mddGetResolvedPackageFullNameForPackageDependency(packageDependencyId_FrameworkMathAdd.get(), &resolvedPackageFullName));
Assert::IsNotNull(resolvedPackageFullName.get());
VERIFY_ARE_EQUAL(S_OK, mddGetResolvedPackageFullNameForPackageDependency(packageDependencyId_FrameworkMathAdd.get(), &resolvedPackageFullName));
VERIFY_IS_NOT_NULL(resolvedPackageFullName.get());
std::wstring actualResolvedPackageFullName{ resolvedPackageFullName.get() };
const auto& expectedResolvedPackageFullName{ expectedPackageFullName_FrameworkMathAdd };
Assert::AreEqual(expectedResolvedPackageFullName, actualResolvedPackageFullName);
VERIFY_ARE_EQUAL(expectedResolvedPackageFullName, actualResolvedPackageFullName);
// Tear down our dynamic dependencies
@ -188,20 +178,20 @@ void Test::DynamicDependency::Test_Win32::GetResolvedPackageFullName_Null()
{
PCWSTR packageDependencyId{};
wil::unique_process_heap_string packageFullName;
Assert::AreEqual(E_INVALIDARG, MddGetResolvedPackageFullNameForPackageDependency(packageDependencyId, &packageFullName));
VERIFY_ARE_EQUAL(E_INVALIDARG, MddGetResolvedPackageFullNameForPackageDependency(packageDependencyId, &packageFullName));
}
void Test::DynamicDependency::Test_Win32::GetResolvedPackageFullName_NotFound()
{
PCWSTR packageDependencyId{ L"This.Does.Not.Exist" };
wil::unique_process_heap_string packageFullName;
Assert::AreEqual(HRESULT_FROM_WIN32(ERROR_NOT_FOUND), MddGetResolvedPackageFullNameForPackageDependency(packageDependencyId, &packageFullName));
VERIFY_ARE_EQUAL(HRESULT_FROM_WIN32(ERROR_NOT_FOUND), MddGetResolvedPackageFullNameForPackageDependency(packageDependencyId, &packageFullName));
}
void Test::DynamicDependency::Test_Win32::GetIdForPackageDependencyContext_Null()
{
wil::unique_process_heap_string id;
Assert::AreEqual(E_INVALIDARG, MddGetIdForPackageDependencyContext(nullptr, wil::out_param(id)));
VERIFY_ARE_EQUAL(E_INVALIDARG, MddGetIdForPackageDependencyContext(nullptr, wil::out_param(id)));
}
void Test::DynamicDependency::Test_Win32::GetIdForPackageDependencyContext()
@ -210,8 +200,8 @@ void Test::DynamicDependency::Test_Win32::GetIdForPackageDependencyContext()
MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext_FrameworkMathAdd{ Mdd_Add(packageDependencyId_FrameworkMathAdd.get()) };
wil::unique_process_heap_string id;
Assert::AreEqual(S_OK, MddGetIdForPackageDependencyContext(packageDependencyContext_FrameworkMathAdd, wil::out_param(id)));
Assert::AreEqual(std::wstring(packageDependencyId_FrameworkMathAdd.get()), std::wstring(id.get()));
VERIFY_ARE_EQUAL(S_OK, MddGetIdForPackageDependencyContext(packageDependencyContext_FrameworkMathAdd, wil::out_param(id)));
VERIFY_ARE_EQUAL(std::wstring(packageDependencyId_FrameworkMathAdd.get()), std::wstring(id.get()));
MddRemovePackageDependency(packageDependencyContext_FrameworkMathAdd);
MddDeletePackageDependency(packageDependencyId_FrameworkMathAdd.get());
@ -223,14 +213,14 @@ void Test::DynamicDependency::Test_Win32::VerifyPackageDependency(
PCWSTR expectedPackageFullName)
{
wil::unique_process_heap_string packageFullName;
Assert::AreEqual(expectedHR, MddGetResolvedPackageFullNameForPackageDependency(packageDependencyId, &packageFullName));
VERIFY_ARE_EQUAL(expectedHR, MddGetResolvedPackageFullNameForPackageDependency(packageDependencyId, &packageFullName));
if (!expectedPackageFullName)
{
Assert::IsTrue(!packageFullName);
VERIFY_IS_TRUE(!packageFullName);
}
else
{
Assert::AreEqual(std::wstring(packageFullName.get()), std::wstring(expectedPackageFullName));
VERIFY_ARE_EQUAL(std::wstring(packageFullName.get()), std::wstring(expectedPackageFullName));
}
}
@ -246,28 +236,28 @@ void Test::DynamicDependency::Test_Win32::VerifyPathEnvironmentVariable(PCWSTR p
{
std::wstring expectedPath{ path };
std::wstring pathEnvironmentVariable{ wil::TryGetEnvironmentVariableW(L"PATH").get() };
Assert::AreEqual(expectedPath, pathEnvironmentVariable);
VERIFY_ARE_EQUAL(expectedPath, pathEnvironmentVariable);
}
void Test::DynamicDependency::Test_Win32::VerifyPathEnvironmentVariable(PCWSTR path1, PCWSTR path)
{
std::wstring pathEnvironmentVariable{ wil::TryGetEnvironmentVariableW(L"PATH").get() };
std::wstring expectedPath{ std::wstring(path1) + L";" + path };
Assert::AreEqual(expectedPath, pathEnvironmentVariable);
VERIFY_ARE_EQUAL(expectedPath, pathEnvironmentVariable);
}
void Test::DynamicDependency::Test_Win32::VerifyPathEnvironmentVariable(PCWSTR path1, PCWSTR path2, PCWSTR path)
{
std::wstring pathEnvironmentVariable{ wil::TryGetEnvironmentVariableW(L"PATH").get() };
std::wstring expectedPath{ std::wstring(path1) + L";" + path2 + L";" + path };
Assert::AreEqual(expectedPath, pathEnvironmentVariable);
VERIFY_ARE_EQUAL(expectedPath, pathEnvironmentVariable);
}
void Test::DynamicDependency::Test_Win32::VerifyPathEnvironmentVariable(PCWSTR path1, PCWSTR path2, PCWSTR path3, PCWSTR path)
{
std::wstring pathEnvironmentVariable{ wil::TryGetEnvironmentVariableW(L"PATH").get() };
std::wstring expectedPath{ std::wstring(path1) + L";" + path2 + L";" + path3 + L";" + path };
Assert::AreEqual(expectedPath, pathEnvironmentVariable);
VERIFY_ARE_EQUAL(expectedPath, pathEnvironmentVariable);
}
void Test::DynamicDependency::Test_Win32::VerifyPathEnvironmentVariable(const std::wstring& path1, PCWSTR path)
@ -292,10 +282,10 @@ void Test::DynamicDependency::Test_Win32::VerifyPackageInPackageGraph(
UINT32 packageInfoCount{};
const PACKAGE_INFO* packageInfo{};
wil::unique_cotaskmem_ptr<BYTE[]> packageInfosBuffer;
Assert::AreEqual(expectedHR, GetCurrentPackageInfo(packageInfoCount, packageInfo, packageInfosBuffer));
VERIFY_ARE_EQUAL(expectedHR, GetCurrentPackageInfo(packageInfoCount, packageInfo, packageInfosBuffer));
if (expectedHR == S_OK)
{
Assert::AreNotEqual(-1, FindPackageFullNameInPackageInfoArray(packageFullName, packageInfoCount, packageInfo));
VERIFY_ARE_NOT_EQUAL(-1, FindPackageFullNameInPackageInfoArray(packageFullName, packageInfoCount, packageInfo));
}
}
@ -306,10 +296,10 @@ void Test::DynamicDependency::Test_Win32::VerifyPackageNotInPackageGraph(
UINT32 packageInfoCount{};
const PACKAGE_INFO* packageInfo{};
wil::unique_cotaskmem_ptr<BYTE[]> packageInfosBuffer;
Assert::AreEqual(expectedHR, GetCurrentPackageInfo(packageInfoCount, packageInfo, packageInfosBuffer));
VERIFY_ARE_EQUAL(expectedHR, GetCurrentPackageInfo(packageInfoCount, packageInfo, packageInfosBuffer));
if (expectedHR == S_OK)
{
Assert::AreEqual(-1, FindPackageFullNameInPackageInfoArray(packageFullName, packageInfoCount, packageInfo));
VERIFY_ARE_EQUAL(-1, FindPackageFullNameInPackageInfoArray(packageFullName, packageInfoCount, packageInfo));
}
}
@ -385,7 +375,7 @@ wil::unique_process_heap_string Test::DynamicDependency::Test_Win32::Mdd_TryCrea
{
PACKAGE_VERSION minVersion{};
wil::unique_process_heap_string packageDependencyId;
Assert::AreEqual(expectedHR, MddTryCreatePackageDependency(nullptr, packageFamilyName, minVersion, architectures, lifetimeKind, lifetimeArtifact, options, &packageDependencyId));
VERIFY_ARE_EQUAL(expectedHR, MddTryCreatePackageDependency(nullptr, packageFamilyName, minVersion, architectures, lifetimeKind, lifetimeArtifact, options, &packageDependencyId));
return packageDependencyId;
}
@ -476,7 +466,7 @@ MDD_PACKAGEDEPENDENCY_CONTEXT Test::DynamicDependency::Test_Win32::Mdd_Add(
wil::unique_process_heap_string& packageFullName)
{
MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext{};
Assert::AreEqual(expectedHR, MddAddPackageDependency(packageDependencyId, rank, options, &packageDependencyContext, &packageFullName));
VERIFY_ARE_EQUAL(expectedHR, MddAddPackageDependency(packageDependencyId, rank, options, &packageDependencyContext, &packageFullName));
return packageDependencyContext;
}
@ -485,8 +475,8 @@ HANDLE Test::DynamicDependency::Test_Win32::File_CreateTemporary(
{
wil::unique_hfile file{ ::CreateFileW(filename.c_str(), GENERIC_READ | GENERIC_WRITE, 0,
nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, nullptr)};
Assert::IsTrue(file.is_valid());
Assert::IsTrue(std::filesystem::exists(filename));
VERIFY_IS_TRUE(file.is_valid());
VERIFY_IS_TRUE(std::filesystem::exists(filename));
return file.release();
}
@ -498,7 +488,7 @@ HKEY Test::DynamicDependency::Test_Win32::Registry_CreateKey(
wil::unique_hkey hkey;
DWORD disposition{};
Assert::AreEqual(ERROR_SUCCESS, ::RegCreateKeyExW(root, subkey, 0, nullptr, REG_OPTION_VOLATILE,
VERIFY_ARE_EQUAL(ERROR_SUCCESS, ::RegCreateKeyExW(root, subkey, 0, nullptr, REG_OPTION_VOLATILE,
KEY_READ | KEY_WRITE, nullptr, wil::out_param(hkey), &disposition));
return hkey.release();
}
@ -510,7 +500,7 @@ void Test::DynamicDependency::Test_Win32::Registry_DeleteKey(
auto root{ Registry_Key_Parse(key, subkey) };
auto rc{ ::RegDeleteKeyExW(root, subkey, 0, 0) };
Assert::IsTrue((rc == ERROR_SUCCESS) || (rc == ERROR_FILE_NOT_FOUND));
VERIFY_IS_TRUE((rc == ERROR_SUCCESS) || (rc == ERROR_FILE_NOT_FOUND));
}
HKEY Test::DynamicDependency::Test_Win32::Registry_Key_Parse(
@ -529,8 +519,8 @@ HKEY Test::DynamicDependency::Test_Win32::Registry_Key_Parse(
{
HKEY root{};
auto offset = key.find(L'\\');
Assert::AreNotEqual(std::wstring::npos, offset);
Assert::AreNotEqual(size_t{0}, offset);
VERIFY_ARE_NOT_EQUAL(std::wstring::npos, offset);
VERIFY_ARE_NOT_EQUAL(size_t{0}, offset);
auto prefix{ key.substr(0, offset) };
if (prefix == L"HKCR")
{
@ -548,8 +538,8 @@ HKEY Test::DynamicDependency::Test_Win32::Registry_Key_Parse(
{
root = HKEY_USERS;
}
Assert::IsTrue(root != HKEY{});
Assert::IsTrue(key.length() > prefix.length() + 1);
VERIFY_IS_TRUE(root != HKEY{});
VERIFY_IS_TRUE(key.length() > prefix.length() + 1);
offsetToSubkey = ++offset;
return root;
@ -566,7 +556,7 @@ std::wstring Test::DynamicDependency::Test_Win32::GetPathEnvironmentVariableMinu
const auto pathPrefixLength{ wcslen(pathPrefix) };
auto pathEnvironmentVariable{ GetPathEnvironmentVariable() };
Assert::IsTrue(pathEnvironmentVariable.length() >= pathPrefixLength);
VERIFY_IS_TRUE(pathEnvironmentVariable.length() >= pathPrefixLength);
auto pathMinusPrefix{ pathEnvironmentVariable.c_str() + pathPrefixLength };
if (*pathMinusPrefix == L';')

Просмотреть файл

@ -5,10 +5,16 @@
namespace Test::DynamicDependency
{
TEST_CLASS(Test_Win32)
class Test_Win32
{
public:
TEST_CLASS_INITIALIZE(Setup);
BEGIN_TEST_CLASS(Test_Win32)
//TEST_CLASS_PROPERTY(L"IsolationLevel", L"Method")
TEST_CLASS_PROPERTY(L"ThreadingModel", L"MTA")
//TEST_CLASS_PROPERTY(L"RunFixtureAs:Class", L"RestrictedUser")
END_TEST_CLASS()
TEST_CLASS_SETUP(Setup);
TEST_CLASS_CLEANUP(Cleanup);
TEST_METHOD(Create_Delete);

Просмотреть файл

@ -13,8 +13,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
void Test::DynamicDependency::Test_Win32::Add_Rank_A0_B10()
{
// Setup our dynamic dependencies
@ -42,9 +40,9 @@ void Test::DynamicDependency::Test_Win32::Add_Rank_A0_B10()
wil::unique_process_heap_string packageFullName_FrameworkMathAdd;
const INT32 rank{ 10 };
MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext_FrameworkMathAdd{ Mdd_Add(packageDependencyId_FrameworkMathAdd.get(), rank, packageFullName_FrameworkMathAdd) };
Assert::IsNotNull(packageFullName_FrameworkMathAdd.get());
VERIFY_IS_NOT_NULL(packageFullName_FrameworkMathAdd.get());
std::wstring actualPackageFullName_FrameworkMathAdd{ packageFullName_FrameworkMathAdd.get() };
Assert::AreEqual(actualPackageFullName_FrameworkMathAdd, expectedPackageFullName_FrameworkMathAdd);
VERIFY_ARE_EQUAL(actualPackageFullName_FrameworkMathAdd, expectedPackageFullName_FrameworkMathAdd);
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -60,15 +58,15 @@ void Test::DynamicDependency::Test_Win32::Add_Rank_A0_B10()
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, mathAddDllFilename) };
Assert::IsNotNull(mathAddDll.get(), message.get());
VERIFY_IS_NOT_NULL(mathAddDll.get(), message.get());
}
auto mathAdd{ GetProcAddressByFunctionDeclaration(mathAddDll.get(), Math_Add) };
Assert::IsNotNull(mathAdd);
VERIFY_IS_NOT_NULL(mathAdd);
const int expectedValue{ 2 + 3 };
const auto actualValue{ mathAdd(2, 3) };
Assert::AreEqual(expectedValue, actualValue);
VERIFY_ARE_EQUAL(expectedValue, actualValue);
// Tear down our dynamic dependencies

Просмотреть файл

@ -13,8 +13,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
void Test::DynamicDependency::Test_Win32::Add_Rank_Bneg10_A0()
{
// Setup our dynamic dependencies
@ -42,9 +40,9 @@ void Test::DynamicDependency::Test_Win32::Add_Rank_Bneg10_A0()
wil::unique_process_heap_string packageFullName_FrameworkMathAdd;
const INT32 rank{ -10 };
MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext_FrameworkMathAdd{ Mdd_Add(packageDependencyId_FrameworkMathAdd.get(), rank, packageFullName_FrameworkMathAdd) };
Assert::IsNotNull(packageFullName_FrameworkMathAdd.get());
VERIFY_IS_NOT_NULL(packageFullName_FrameworkMathAdd.get());
std::wstring actualPackageFullName_FrameworkMathAdd{ packageFullName_FrameworkMathAdd.get() };
Assert::AreEqual(actualPackageFullName_FrameworkMathAdd, expectedPackageFullName_FrameworkMathAdd);
VERIFY_ARE_EQUAL(actualPackageFullName_FrameworkMathAdd, expectedPackageFullName_FrameworkMathAdd);
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -60,15 +58,15 @@ void Test::DynamicDependency::Test_Win32::Add_Rank_Bneg10_A0()
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, mathAddDllFilename) };
Assert::IsNotNull(mathAddDll.get(), message.get());
VERIFY_IS_NOT_NULL(mathAddDll.get(), message.get());
}
auto mathAdd{ GetProcAddressByFunctionDeclaration(mathAddDll.get(), Math_Add) };
Assert::IsNotNull(mathAdd);
VERIFY_IS_NOT_NULL(mathAdd);
const int expectedValue{ 2 + 3 };
const auto actualValue{ mathAdd(2, 3) };
Assert::AreEqual(expectedValue, actualValue);
VERIFY_ARE_EQUAL(expectedValue, actualValue);
// Tear down our dynamic dependencies

Просмотреть файл

@ -13,8 +13,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
void Test::DynamicDependency::Test_Win32::Add_Rank_B0prepend_A0()
{
// Setup our dynamic dependencies
@ -42,9 +40,9 @@ void Test::DynamicDependency::Test_Win32::Add_Rank_B0prepend_A0()
wil::unique_process_heap_string packageFullName_FrameworkMathAdd;
const INT32 rank{ MDD_PACKAGE_DEPENDENCY_RANK_DEFAULT };
MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext_FrameworkMathAdd{ Mdd_Add(packageDependencyId_FrameworkMathAdd.get(), rank, MddAddPackageDependencyOptions::PrependIfRankCollision, packageFullName_FrameworkMathAdd) };
Assert::IsNotNull(packageFullName_FrameworkMathAdd.get());
VERIFY_IS_NOT_NULL(packageFullName_FrameworkMathAdd.get());
std::wstring actualPackageFullName_FrameworkMathAdd{ packageFullName_FrameworkMathAdd.get() };
Assert::AreEqual(actualPackageFullName_FrameworkMathAdd, expectedPackageFullName_FrameworkMathAdd);
VERIFY_ARE_EQUAL(actualPackageFullName_FrameworkMathAdd, expectedPackageFullName_FrameworkMathAdd);
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -60,15 +58,15 @@ void Test::DynamicDependency::Test_Win32::Add_Rank_B0prepend_A0()
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, mathAddDllFilename) };
Assert::IsNotNull(mathAddDll.get(), message.get());
VERIFY_IS_NOT_NULL(mathAddDll.get(), message.get());
}
auto mathAdd{ GetProcAddressByFunctionDeclaration(mathAddDll.get(), Math_Add) };
Assert::IsNotNull(mathAdd);
VERIFY_IS_NOT_NULL(mathAdd);
const int expectedValue{ 2 + 3 };
const auto actualValue{ mathAdd(2, 3) };
Assert::AreEqual(expectedValue, actualValue);
VERIFY_ARE_EQUAL(expectedValue, actualValue);
// Tear down our dynamic dependencies

Просмотреть файл

@ -13,8 +13,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
void Test::DynamicDependency::Test_Win32::Create_Add_Architectures_Current()
{
// Setup our dynamic dependencies
@ -45,9 +43,9 @@ void Test::DynamicDependency::Test_Win32::Create_Add_Architectures_Current()
wil::unique_process_heap_string packageFullName_FrameworkMathAdd;
MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext_FrameworkMathAdd{ Mdd_Add(packageDependencyId_FrameworkMathAdd.get(), packageFullName_FrameworkMathAdd) };
Assert::IsNotNull(packageFullName_FrameworkMathAdd.get());
VERIFY_IS_NOT_NULL(packageFullName_FrameworkMathAdd.get());
std::wstring actualPackageFullName_FrameworkMathAdd{ packageFullName_FrameworkMathAdd.get() };
Assert::AreEqual(actualPackageFullName_FrameworkMathAdd, expectedPackageFullName_FrameworkMathAdd);
VERIFY_ARE_EQUAL(actualPackageFullName_FrameworkMathAdd, expectedPackageFullName_FrameworkMathAdd);
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -63,15 +61,15 @@ void Test::DynamicDependency::Test_Win32::Create_Add_Architectures_Current()
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, mathAddDllFilename) };
Assert::IsNotNull(mathAddDll.get(), message.get());
VERIFY_IS_NOT_NULL(mathAddDll.get(), message.get());
}
auto mathAdd{ GetProcAddressByFunctionDeclaration(mathAddDll.get(), Math_Add) };
Assert::IsNotNull(mathAdd);
VERIFY_IS_NOT_NULL(mathAdd);
const int expectedValue{ 2 + 3 };
const auto actualValue{ mathAdd(2, 3) };
Assert::AreEqual(expectedValue, actualValue);
VERIFY_ARE_EQUAL(expectedValue, actualValue);
// Tear down our dynamic dependencies

Просмотреть файл

@ -13,8 +13,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
void Test::DynamicDependency::Test_Win32::Create_Add_Architectures_Explicit()
{
// Setup our dynamic dependencies
@ -51,9 +49,9 @@ void Test::DynamicDependency::Test_Win32::Create_Add_Architectures_Explicit()
wil::unique_process_heap_string packageFullName_FrameworkMathAdd;
MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext_FrameworkMathAdd{ Mdd_Add(packageDependencyId_FrameworkMathAdd.get(), packageFullName_FrameworkMathAdd) };
Assert::IsNotNull(packageFullName_FrameworkMathAdd.get());
VERIFY_IS_NOT_NULL(packageFullName_FrameworkMathAdd.get());
std::wstring actualPackageFullName_FrameworkMathAdd{ packageFullName_FrameworkMathAdd.get() };
Assert::AreEqual(actualPackageFullName_FrameworkMathAdd, expectedPackageFullName_FrameworkMathAdd);
VERIFY_ARE_EQUAL(actualPackageFullName_FrameworkMathAdd, expectedPackageFullName_FrameworkMathAdd);
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -69,15 +67,15 @@ void Test::DynamicDependency::Test_Win32::Create_Add_Architectures_Explicit()
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, mathAddDllFilename) };
Assert::IsNotNull(mathAddDll.get(), message.get());
VERIFY_IS_NOT_NULL(mathAddDll.get(), message.get());
}
auto mathAdd{ GetProcAddressByFunctionDeclaration(mathAddDll.get(), Math_Add) };
Assert::IsNotNull(mathAdd);
VERIFY_IS_NOT_NULL(mathAdd);
const int expectedValue{ 2 + 3 };
const auto actualValue{ mathAdd(2, 3) };
Assert::AreEqual(expectedValue, actualValue);
VERIFY_ARE_EQUAL(expectedValue, actualValue);
// Tear down our dynamic dependencies

Просмотреть файл

@ -13,8 +13,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
void Test::DynamicDependency::Test_Win32::Create_DoNotVerifyDependencyResolution()
{
// Setup our dynamic dependencies
@ -32,7 +30,7 @@ void Test::DynamicDependency::Test_Win32::Create_DoNotVerifyDependencyResolution
// Create a package dependency without verifying its resolution
TP::RemovePackage_FrameworkMathAdd();
Assert::IsFalse(TP::IsPackageRegistered(Test::Packages::FrameworkMathAdd::c_PackageFullName));
VERIFY_IS_FALSE(TP::IsPackageRegistered(Test::Packages::FrameworkMathAdd::c_PackageFullName));
auto options{ MddCreatePackageDependencyOptions::DoNotVerifyDependencyResolution };
wil::unique_process_heap_string packageDependencyId_FrameworkMathAdd{ Mdd_TryCreate_FrameworkMathAdd(options) };
@ -48,9 +46,9 @@ void Test::DynamicDependency::Test_Win32::Create_DoNotVerifyDependencyResolution
wil::unique_process_heap_string packageFullName_FrameworkMathAdd;
MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext_FrameworkMathAdd{ Mdd_Add(packageDependencyId_FrameworkMathAdd.get(), packageFullName_FrameworkMathAdd) };
Assert::IsNotNull(packageFullName_FrameworkMathAdd.get());
VERIFY_IS_NOT_NULL(packageFullName_FrameworkMathAdd.get());
std::wstring actualPackageFullName_FrameworkMathAdd{ packageFullName_FrameworkMathAdd.get() };
Assert::AreEqual(actualPackageFullName_FrameworkMathAdd, expectedPackageFullName_FrameworkMathAdd);
VERIFY_ARE_EQUAL(actualPackageFullName_FrameworkMathAdd, expectedPackageFullName_FrameworkMathAdd);
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -66,15 +64,15 @@ void Test::DynamicDependency::Test_Win32::Create_DoNotVerifyDependencyResolution
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, mathAddDllFilename) };
Assert::IsNotNull(mathAddDll.get(), message.get());
VERIFY_IS_NOT_NULL(mathAddDll.get(), message.get());
}
auto mathAdd{ GetProcAddressByFunctionDeclaration(mathAddDll.get(), Math_Add) };
Assert::IsNotNull(mathAdd);
VERIFY_IS_NOT_NULL(mathAdd);
const int expectedValue{ 2 + 3 };
const auto actualValue{ mathAdd(2, 3) };
Assert::AreEqual(expectedValue, actualValue);
VERIFY_ARE_EQUAL(expectedValue, actualValue);
// Tear down our dynamic dependencies

Просмотреть файл

@ -13,8 +13,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
void Test::DynamicDependency::Test_Win32::FullLifecycle_FilePathLifetime_Frameworks_ProjectReunion_MathAdd()
{
// Setup our dynamic dependencies
@ -33,8 +31,8 @@ void Test::DynamicDependency::Test_Win32::FullLifecycle_FilePathLifetime_Framewo
auto lifetimeArtifactPath{ std::filesystem::temp_directory_path() };
auto lifetimeArtifactFilename{ lifetimeArtifactPath / L"Test-MathAdd-LifetimeArtifact.tmp" };
wil::unique_hfile lifetimeArtifactFile{ File_CreateTemporary(lifetimeArtifactFilename) };
Assert::IsTrue(lifetimeArtifactFile.is_valid());
Assert::IsTrue(std::filesystem::exists(lifetimeArtifactFilename));
VERIFY_IS_TRUE(lifetimeArtifactFile.is_valid());
VERIFY_IS_TRUE(std::filesystem::exists(lifetimeArtifactFilename));
wil::unique_process_heap_string packageDependencyId_FrameworkMathAdd{ Mdd_TryCreate_FrameworkMathAdd(MddPackageDependencyLifetimeKind::FilePath, lifetimeArtifactFilename.c_str()) };
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
@ -46,9 +44,9 @@ void Test::DynamicDependency::Test_Win32::FullLifecycle_FilePathLifetime_Framewo
wil::unique_process_heap_string packageFullName_FrameworkMathAdd;
MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext_FrameworkMathAdd{ Mdd_Add(packageDependencyId_FrameworkMathAdd.get(), packageFullName_FrameworkMathAdd) };
Assert::IsNotNull(packageFullName_FrameworkMathAdd.get());
VERIFY_IS_NOT_NULL(packageFullName_FrameworkMathAdd.get());
std::wstring actualPackageFullName_FrameworkMathAdd{ packageFullName_FrameworkMathAdd.get() };
Assert::AreEqual(actualPackageFullName_FrameworkMathAdd, expectedPackageFullName_FrameworkMathAdd);
VERIFY_ARE_EQUAL(actualPackageFullName_FrameworkMathAdd, expectedPackageFullName_FrameworkMathAdd);
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -59,15 +57,15 @@ void Test::DynamicDependency::Test_Win32::FullLifecycle_FilePathLifetime_Framewo
// -- Delete the lifetime artifact
lifetimeArtifactFile.reset();
Assert::IsFalse(lifetimeArtifactFile.is_valid());
Assert::IsFalse(std::filesystem::exists(lifetimeArtifactFilename));
VERIFY_IS_FALSE(lifetimeArtifactFile.is_valid());
VERIFY_IS_FALSE(std::filesystem::exists(lifetimeArtifactFilename));
// Add it a 2nd time. The package dependency is deleted but still resolved so this should succeed. PackageGraph = [ Fwk, MathAdd, MathAdd ]
wil::unique_process_heap_string packageFullName;
auto context{ Mdd_Add(packageDependencyId_FrameworkMathAdd.get(), packageFullName) };
Assert::IsNotNull(packageFullName.get());
VERIFY_IS_NOT_NULL(packageFullName.get());
std::wstring actualPackageFullName{ packageFullName.get() };
Assert::AreEqual(actualPackageFullName, expectedPackageFullName_FrameworkMathAdd);
VERIFY_ARE_EQUAL(actualPackageFullName, expectedPackageFullName_FrameworkMathAdd);
VerifyPathEnvironmentVariable(packagePath_ProjectReunionFramework, packagePath_FrameworkMathAdd, packagePath_FrameworkMathAdd, pathEnvironmentVariable.c_str());
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, expectedPackageFullName_FrameworkMathAdd);
@ -86,15 +84,15 @@ void Test::DynamicDependency::Test_Win32::FullLifecycle_FilePathLifetime_Framewo
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, mathAddDllFilename) };
Assert::IsNotNull(mathAddDll.get(), message.get());
VERIFY_IS_NOT_NULL(mathAddDll.get(), message.get());
}
auto mathAdd{ GetProcAddressByFunctionDeclaration(mathAddDll.get(), Math_Add) };
Assert::IsNotNull(mathAdd);
VERIFY_IS_NOT_NULL(mathAdd);
const int expectedValue{ 2 + 3 };
const auto actualValue{ mathAdd(2, 3) };
Assert::AreEqual(expectedValue, actualValue);
VERIFY_ARE_EQUAL(expectedValue, actualValue);
// Tear down our dynamic dependencies

Просмотреть файл

@ -13,8 +13,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
void Test::DynamicDependency::Test_Win32::FullLifecycle_ProcessLifetime_Frameworks_ProjectReunion_MathAdd()
{
// Setup our dynamic dependencies
@ -41,9 +39,9 @@ void Test::DynamicDependency::Test_Win32::FullLifecycle_ProcessLifetime_Framewor
wil::unique_process_heap_string packageFullName_FrameworkMathAdd;
MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext_FrameworkMathAdd{ Mdd_Add(packageDependencyId_FrameworkMathAdd.get(), packageFullName_FrameworkMathAdd) };
Assert::IsNotNull(packageFullName_FrameworkMathAdd.get());
VERIFY_IS_NOT_NULL(packageFullName_FrameworkMathAdd.get());
std::wstring actualPackageFullName_FrameworkMathAdd{ packageFullName_FrameworkMathAdd.get() };
Assert::AreEqual(actualPackageFullName_FrameworkMathAdd, expectedPackageFullName_FrameworkMathAdd);
VERIFY_ARE_EQUAL(actualPackageFullName_FrameworkMathAdd, expectedPackageFullName_FrameworkMathAdd);
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -59,15 +57,15 @@ void Test::DynamicDependency::Test_Win32::FullLifecycle_ProcessLifetime_Framewor
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, mathAddDllFilename) };
Assert::IsNotNull(mathAddDll.get(), message.get());
VERIFY_IS_NOT_NULL(mathAddDll.get(), message.get());
}
auto mathAdd{ GetProcAddressByFunctionDeclaration(mathAddDll.get(), Math_Add) };
Assert::IsNotNull(mathAdd);
VERIFY_IS_NOT_NULL(mathAdd);
const int expectedValue{ 2 + 3 };
const auto actualValue{ mathAdd(2, 3) };
Assert::AreEqual(expectedValue, actualValue);
VERIFY_ARE_EQUAL(expectedValue, actualValue);
// Tear down our dynamic dependencies

Просмотреть файл

@ -13,8 +13,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
void Test::DynamicDependency::Test_Win32::FullLifecycle_RegistryLifetime_Frameworks_ProjectReunion_MathAdd()
{
// Setup our dynamic dependencies
@ -33,7 +31,7 @@ void Test::DynamicDependency::Test_Win32::FullLifecycle_RegistryLifetime_Framewo
std::wstring lifetimeArtifactRegistryKey{ L"HKCU\\SOFTWARE\\TestProjectReunion-DynamicDependency" };
{
wil::unique_hkey lifetimeArtifactKey{ Registry_CreateKey(lifetimeArtifactRegistryKey) };
Assert::IsTrue(lifetimeArtifactKey.is_valid());
VERIFY_IS_TRUE(lifetimeArtifactKey.is_valid());
}
wil::unique_process_heap_string packageDependencyId_FrameworkMathAdd{ Mdd_TryCreate_FrameworkMathAdd(MddPackageDependencyLifetimeKind::RegistryKey, lifetimeArtifactRegistryKey.c_str()) };
@ -46,9 +44,9 @@ void Test::DynamicDependency::Test_Win32::FullLifecycle_RegistryLifetime_Framewo
wil::unique_process_heap_string packageFullName_FrameworkMathAdd;
MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext_FrameworkMathAdd{ Mdd_Add(packageDependencyId_FrameworkMathAdd.get(), packageFullName_FrameworkMathAdd) };
Assert::IsNotNull(packageFullName_FrameworkMathAdd.get());
VERIFY_IS_NOT_NULL(packageFullName_FrameworkMathAdd.get());
std::wstring actualPackageFullName_FrameworkMathAdd{ packageFullName_FrameworkMathAdd.get() };
Assert::AreEqual(actualPackageFullName_FrameworkMathAdd, expectedPackageFullName_FrameworkMathAdd);
VERIFY_ARE_EQUAL(actualPackageFullName_FrameworkMathAdd, expectedPackageFullName_FrameworkMathAdd);
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -63,9 +61,9 @@ void Test::DynamicDependency::Test_Win32::FullLifecycle_RegistryLifetime_Framewo
// Add it a 2nd time. The package dependency is deleted but still resolved so this should succeed. PackageGraph = [ Fwk, MathAdd, MathAdd ]
wil::unique_process_heap_string packageFullName;
auto context{ Mdd_Add(packageDependencyId_FrameworkMathAdd.get(), packageFullName) };
Assert::IsNotNull(packageFullName.get());
VERIFY_IS_NOT_NULL(packageFullName.get());
std::wstring actualPackageFullName{ packageFullName.get() };
Assert::AreEqual(actualPackageFullName, expectedPackageFullName_FrameworkMathAdd);
VERIFY_ARE_EQUAL(actualPackageFullName, expectedPackageFullName_FrameworkMathAdd);
VerifyPathEnvironmentVariable(packagePath_ProjectReunionFramework, packagePath_FrameworkMathAdd, packagePath_FrameworkMathAdd, pathEnvironmentVariable.c_str());
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, expectedPackageFullName_FrameworkMathAdd);
@ -84,15 +82,15 @@ void Test::DynamicDependency::Test_Win32::FullLifecycle_RegistryLifetime_Framewo
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, mathAddDllFilename) };
Assert::IsNotNull(mathAddDll.get(), message.get());
VERIFY_IS_NOT_NULL(mathAddDll.get(), message.get());
}
auto mathAdd{ GetProcAddressByFunctionDeclaration(mathAddDll.get(), Math_Add) };
Assert::IsNotNull(mathAdd);
VERIFY_IS_NOT_NULL(mathAdd);
const int expectedValue{ 2 + 3 };
const auto actualValue{ mathAdd(2, 3) };
Assert::AreEqual(expectedValue, actualValue);
VERIFY_ARE_EQUAL(expectedValue, actualValue);
// Tear down our dynamic dependencies

Просмотреть файл

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Taef" version="10.58.210222006-develop" targetFramework="native" />
</packages>

Просмотреть файл

@ -32,9 +32,8 @@
#include <appmodel_msixdynamicdependency.h>
#include "CppUnitTest.h"
#include <WexTestClass.h>
#include "TestCom.h"
#include "TestFilesystem.h"
#include "TestPackages.h"

Просмотреть файл

@ -1,73 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#pragma once
namespace Microsoft::VisualStudio::CppUnitTestFramework
{
template<> inline std::wstring ToString<winrt::hstring>(const winrt::hstring& t)
{
RETURN_WIDE_STRING(t.c_str());
}
template<> inline std::wstring ToString<winrt::hstring>(const winrt::hstring* t)
{
if (NULL == t)
{
return std::wstring(L"(NULL)");
}
RETURN_WIDE_STRING(t->c_str());
}
template<> inline std::wstring ToString<winrt::hstring>(winrt::hstring* t)
{
if (NULL == t)
{
return std::wstring(L"(NULL)");
}
RETURN_WIDE_STRING(t->c_str());
}
class AssertX
{
public:
static void AreEqual(const winrt::hstring& expected, const winrt::hstring& actual, const char* message, const __LineInfo* pLineInfo = NULL)
{
Assert::AreEqual(expected.c_str(), actual.c_str(), message, pLineInfo);
}
static void AreEqual(const winrt::hstring& expected, const winrt::hstring& actual, const wchar_t* message, const __LineInfo* pLineInfo = NULL)
{
Assert::AreEqual(expected.c_str(), actual.c_str(), message, pLineInfo);
}
static void AreEqual(const winrt::hstring& expected, const winrt::hstring& actual, bool ignoreCase = false, const wchar_t* message = NULL, const __LineInfo* pLineInfo = NULL)
{
Assert::AreEqual(expected.c_str(), actual.c_str(), ignoreCase, message, pLineInfo);
}
static void AreNotEqual(const winrt::hstring& expected, const winrt::hstring& actual, const char* message, const __LineInfo* pLineInfo = NULL)
{
Assert::AreNotEqual(expected.c_str(), actual.c_str(), message, pLineInfo);
}
static void AreNotEqual(const winrt::hstring& expected, const winrt::hstring& actual, const wchar_t* message, const __LineInfo* pLineInfo = NULL)
{
Assert::AreNotEqual(expected.c_str(), actual.c_str(), message, pLineInfo);
}
static void AreNotEqual(const winrt::hstring& expected, const winrt::hstring& actual, bool ignoreCase = false, const wchar_t* message = NULL, const __LineInfo* pLineInfo = NULL)
{
Assert::AreNotEqual(expected.c_str(), actual.c_str(), ignoreCase, message, pLineInfo);
}
static void Succeeded(HRESULT hr, const wchar_t* message = NULL, const __LineInfo* pLineInfo = NULL)
{
Assert::IsTrue(SUCCEEDED(hr), message, pLineInfo);
}
static void Failed(HRESULT hr, const wchar_t* message = NULL, const __LineInfo* pLineInfo = NULL)
{
Assert::IsTrue(FAILED(hr), message, pLineInfo);
}
};
}

Просмотреть файл

@ -13,8 +13,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
void Test::DynamicDependency::Test_WinRT::Create_FilePathLifetime_NoExist()
{
// Setup our dynamic dependencies
@ -39,12 +37,12 @@ void Test::DynamicDependency::Test_WinRT::Create_FilePathLifetime_NoExist()
const auto lifetimeKind{ winrt::Microsoft::ApplicationModel::DynamicDependency::PackageDependencyLifetimeArtifactKind::FilePath };
auto packageDependency_FrameworkMathAdd{ _Create_FrameworkMathAdd(HRESULT_FROM_WIN32(ERROR_CONTEXT_EXPIRED), lifetimeKind, lifetimeArtifactFilename.c_str()) };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Expected exception (value=0x%X ERROR_CONTEXT_EXPIRED) didn't occur", HRESULT_FROM_WIN32(ERROR_CONTEXT_EXPIRED)) };
Assert::Fail(message.get());
VERIFY_FAIL(message.get());
}
catch (const winrt::hresult_error& e)
{
const int32_t expectedHR{ HRESULT_FROM_WIN32(ERROR_CONTEXT_EXPIRED) };
Assert::AreEqual(expectedHR, e.code().value, e.message().c_str());
VERIFY_ARE_EQUAL(expectedHR, e.code().value, e.message().c_str());
}
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);

Просмотреть файл

@ -13,8 +13,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
void Test::DynamicDependency::Test_WinRT::Create_RegistryLifetime_NoExist()
{
// Setup our dynamic dependencies
@ -38,12 +36,12 @@ void Test::DynamicDependency::Test_WinRT::Create_RegistryLifetime_NoExist()
const auto lifetimeKind{ winrt::Microsoft::ApplicationModel::DynamicDependency::PackageDependencyLifetimeArtifactKind::RegistryKey };
auto packageDependency_FrameworkMathAdd{ _Create_FrameworkMathAdd(HRESULT_FROM_WIN32(ERROR_CONTEXT_EXPIRED), lifetimeKind, lifetimeArtifactRegistryKey.c_str()) };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Expected exception (value=0x%X ERROR_CONTEXT_EXPIRED) didn't occur", HRESULT_FROM_WIN32(ERROR_CONTEXT_EXPIRED)) };
Assert::Fail(message.get());
VERIFY_FAIL(message.get());
}
catch (const winrt::hresult_error& e)
{
const int32_t expectedHR{ HRESULT_FROM_WIN32(ERROR_CONTEXT_EXPIRED) };
Assert::AreEqual(expectedHR, e.code().value, e.message().c_str());
VERIFY_ARE_EQUAL(expectedHR, e.code().value, e.message().c_str());
}
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props')" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
@ -322,7 +322,6 @@
<ClCompile Include="pch.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TestCom.cpp" />
<ClCompile Include="TestFilesystem.cpp" />
<ClCompile Include="TestPackages.cpp" />
<ClCompile Include="Test_WinRT_Add_Rank_A0_B10.cpp" />
@ -337,7 +336,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h" />
<ClInclude Include="TestCom.h" />
<ClInclude Include="TestFilesystem.h" />
<ClInclude Include="TestPackages.h" />
<ClInclude Include="Test_WinRT.h" />
@ -358,15 +356,17 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\packages\Microsoft.Taef.10.58.210222006-develop\build\Microsoft.Taef.targets" Condition="Exists('..\..\..\packages\Microsoft.Taef.10.58.210222006-develop\build\Microsoft.Taef.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Taef.10.58.210222006-develop\build\Microsoft.Taef.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Taef.10.58.210222006-develop\build\Microsoft.Taef.targets'))" />
</Target>
</Project>

Просмотреть файл

@ -9,7 +9,7 @@
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<Filter Include="Source Files\Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
@ -18,9 +18,6 @@
<ClCompile Include="pch.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TestCom.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TestFilesystem.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -68,9 +65,6 @@
<ClInclude Include="pch.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="TestCom.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="TestPackages.h">
<Filter>Header Files</Filter>
</ClInclude>

Просмотреть файл

@ -1,41 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#include "pch.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace Test::DynamicDependency::COM
{
void CoSuperInitialize(winrt::apartment_type const type)
{
// CoUninitialize() needs to be called as many times as CoInitialize()
// Keep 'peeling the onion' until we're the 1st to initialize COM
for (;;)
{
const HRESULT hr = WINRT_IMPL_CoInitializeEx(nullptr, static_cast<uint32_t>(type));
if (hr == S_OK)
{
// COM was initialized successfully on this thread
break;
}
else if (hr == S_FALSE)
{
// COM is already initialized the for thead
// Undo the init we just did and the init we just detected
WINRT_IMPL_CoUninitialize();
WINRT_IMPL_CoUninitialize();
}
else if (hr == RPC_E_CHANGED_MODE)
{
// COM is already initialized for the thread as a different apartment type
// This is an error so nothing to do. Undo the init we just detected
WINRT_IMPL_CoUninitialize();
}
else
{
Assert::AreEqual(S_OK, hr, L"Error in CoInitializeEx()");
}
}
}
}

Просмотреть файл

@ -1,7 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
namespace Test::DynamicDependency::COM
{
void CoSuperInitialize(winrt::apartment_type const type = winrt::apartment_type::multi_threaded);
}

Просмотреть файл

@ -3,8 +3,6 @@
#include "pch.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace Test::FileSystem
{
std::filesystem::path GetModulePath(HMODULE hmodule)
@ -24,7 +22,7 @@ namespace Test::FileSystem
{
wil::unique_hmodule dll(LoadLibrary(L"DynamicDependency_Test_WinRT.dll"));
const auto lastError{ GetLastError() };
Assert::IsNotNull(dll.get());
VERIFY_IS_NOT_NULL(dll.get());
return GetModulePath(dll.get());
}

Просмотреть файл

@ -3,8 +3,6 @@
#include "pch.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace TF = ::Test::FileSystem;
namespace Test::Packages
@ -36,7 +34,7 @@ namespace Test::Packages
msix /= packageDirName;
msix /= packageDirName;
msix += L".msix";
Assert::IsTrue(std::filesystem::is_regular_file(msix));
VERIFY_IS_TRUE(std::filesystem::is_regular_file(msix));
}
auto msixUri = winrt::Windows::Foundation::Uri(msix.c_str());
@ -47,7 +45,7 @@ namespace Test::Packages
if (FAILED(deploymentResult.ExtendedErrorCode()))
{
auto message = wil::str_printf<wil::unique_process_heap_string>(L"AddPackageAsync('%s') = 0x%0X %s", packageFullName, deploymentResult.ExtendedErrorCode(), deploymentResult.ErrorText().c_str());
Assert::Fail(message.get());
VERIFY_FAIL(message.get());
}
}
@ -66,7 +64,7 @@ namespace Test::Packages
if (!deploymentResult)
{
auto message = wil::str_printf<wil::unique_process_heap_string>(L"RemovePackageAsync('%s') = 0x%0X %s", packageFullName, deploymentResult.ExtendedErrorCode(), deploymentResult.ErrorText().c_str());
Assert::Fail(message.get());
VERIFY_FAIL(message.get());
}
}
@ -88,9 +86,9 @@ namespace Test::Packages
return std::wstring();
}
Assert::AreEqual(ERROR_INSUFFICIENT_BUFFER, rc);
VERIFY_ARE_EQUAL(ERROR_INSUFFICIENT_BUFFER, rc);
auto path = wil::make_process_heap_string(nullptr, pathLength);
Assert::AreEqual(ERROR_SUCCESS, GetPackagePathByFullName(packageFullName, &pathLength, path.get()));
VERIFY_ARE_EQUAL(ERROR_SUCCESS, GetPackagePathByFullName(packageFullName, &pathLength, path.get()));
return std::wstring(path.get());
}

Просмотреть файл

@ -13,19 +13,10 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
wil::unique_hmodule Test::DynamicDependency::Test_WinRT::m_bootstrapDll;
void Test::DynamicDependency::Test_WinRT::Setup()
bool Test::DynamicDependency::Test_WinRT::Setup()
{
// CppUnitTest initializes COM as STA before we get called
// But we don't need (or want) STA, and we do want MTA. We can't
// stop CppUnitTest from initializing COM but we can uninitialize
// it and (re)initialize it as MTA. Don't think of it as crude
// and brutish but rather 'thinking outside the box'...
COM::CoSuperInitialize();
// Remove our packages in case they were previously installed and incompletely removed
TP::RemovePackage_DynamicDependencyLifetimeManager();
TP::RemovePackage_DynamicDependencyDataStore();
@ -50,19 +41,21 @@ void Test::DynamicDependency::Test_WinRT::Setup()
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, bootstrapDllAbsoluteFilename.c_str()) };
Assert::IsNotNull(bootstrapDll.get(), message.get());
VERIFY_IS_NOT_NULL(bootstrapDll.get(), message.get());
}
Assert::AreEqual(S_OK, MddBootstrapTestInitialize(Test::Packages::DynamicDependencyLifetimeManager::c_PackageNamePrefix, Test::Packages::DynamicDependencyLifetimeManager::c_PackagePublisherId));
VERIFY_ARE_EQUAL(S_OK, MddBootstrapTestInitialize(Test::Packages::DynamicDependencyLifetimeManager::c_PackageNamePrefix, Test::Packages::DynamicDependencyLifetimeManager::c_PackagePublisherId));
// Version <major>.0.0.0 to find any framework package for this major version
PACKAGE_VERSION minVersion{ static_cast<UINT64>(Test::Packages::DynamicDependencyLifetimeManager::c_Version.Major) << 48 };
Assert::AreEqual(S_OK, MddBootstrapInitialize(minVersion));
VERIFY_ARE_EQUAL(S_OK, MddBootstrapInitialize(minVersion));
m_bootstrapDll = std::move(bootstrapDll);
return true;
}
void Test::DynamicDependency::Test_WinRT::Cleanup()
bool Test::DynamicDependency::Test_WinRT::Cleanup()
{
MddBootstrapShutdown();
@ -74,10 +67,7 @@ void Test::DynamicDependency::Test_WinRT::Cleanup()
TP::RemovePackage_FrameworkMathMultiply();
TP::RemovePackage_FrameworkMathAdd();
// Undo COM::CoSuperInitialize() and restore the thread to its initial state
// as when CppUnitTest called us. Or as close as we can get to it
winrt::uninit_apartment();
winrt::init_apartment(winrt::apartment_type::single_threaded);
return true;
}
void Test::DynamicDependency::Test_WinRT::Create_Delete()
@ -93,14 +83,14 @@ void Test::DynamicDependency::Test_WinRT::GetFromId_Empty()
{
winrt::hstring packageDependencyId;
auto packageDependency{ winrt::Microsoft::ApplicationModel::DynamicDependency::PackageDependency::GetFromId(packageDependencyId) };
Assert::IsTrue(!packageDependency);
VERIFY_IS_TRUE(!packageDependency);
}
void Test::DynamicDependency::Test_WinRT::GetFromId_NotFound()
{
winrt::hstring packageDependencyId{ L"This.Does.Not.Exist" };
auto packageDependency{ winrt::Microsoft::ApplicationModel::DynamicDependency::PackageDependency::GetFromId(packageDependencyId) };
Assert::IsTrue(!packageDependency);
VERIFY_IS_TRUE(!packageDependency);
}
void Test::DynamicDependency::Test_WinRT::FullLifecycle_ProcessLifetime_Framework_ProjectReunion()
@ -119,9 +109,9 @@ void Test::DynamicDependency::Test_WinRT::FullLifecycle_ProcessLifetime_Framewor
// -- Create
auto packageDependency_FrameworkMathAdd{ _Create_FrameworkMathAdd() };
Assert::IsFalse(!packageDependency_FrameworkMathAdd);
VERIFY_IS_FALSE(!packageDependency_FrameworkMathAdd);
auto packageDependencyId_FrameworkMathAdd{ packageDependency_FrameworkMathAdd.Id() };
Assert::IsFalse(packageDependencyId_FrameworkMathAdd.empty());
VERIFY_IS_FALSE(packageDependencyId_FrameworkMathAdd.empty());
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -131,8 +121,8 @@ void Test::DynamicDependency::Test_WinRT::FullLifecycle_ProcessLifetime_Framewor
// -- Add
auto packageDependencyContext_FrameworkMathAdd{ packageDependency_FrameworkMathAdd.Add() };
Assert::IsFalse(!packageDependencyContext_FrameworkMathAdd);
Assert::AreEqual(std::wstring(packageDependencyContext_FrameworkMathAdd.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VERIFY_IS_FALSE(!packageDependencyContext_FrameworkMathAdd);
VERIFY_ARE_EQUAL(std::wstring(packageDependencyContext_FrameworkMathAdd.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -148,18 +138,18 @@ void Test::DynamicDependency::Test_WinRT::FullLifecycle_ProcessLifetime_Framewor
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, mathAddDllFilename) };
Assert::IsNotNull(mathAddDll.get(), message.get());
VERIFY_IS_NOT_NULL(mathAddDll.get(), message.get());
}
auto mddGetResolvedPackageFullNameForPackageDependency{ GetProcAddressByFunctionDeclaration(mathAddDll.get(), MddGetResolvedPackageFullNameForPackageDependency) };
Assert::IsNotNull(mddGetResolvedPackageFullNameForPackageDependency);
VERIFY_IS_NOT_NULL(mddGetResolvedPackageFullNameForPackageDependency);
wil::unique_process_heap_string resolvedPackageFullName;
Assert::AreEqual(S_OK, mddGetResolvedPackageFullNameForPackageDependency(packageDependency_FrameworkMathAdd.Id().c_str(), &resolvedPackageFullName));
Assert::IsNotNull(resolvedPackageFullName.get());
VERIFY_ARE_EQUAL(S_OK, mddGetResolvedPackageFullNameForPackageDependency(packageDependency_FrameworkMathAdd.Id().c_str(), &resolvedPackageFullName));
VERIFY_IS_NOT_NULL(resolvedPackageFullName.get());
winrt::hstring actualResolvedPackageFullName{ resolvedPackageFullName.get() };
const auto& expectedResolvedPackageFullName{ expectedPackageFullName_FrameworkMathAdd };
Assert::AreEqual(expectedResolvedPackageFullName, actualResolvedPackageFullName);
VERIFY_ARE_EQUAL(expectedResolvedPackageFullName, actualResolvedPackageFullName);
// Tear down our dynamic dependencies
@ -188,14 +178,14 @@ void Test::DynamicDependency::Test_WinRT::VerifyPackageDependency(
PCWSTR expectedPackageFullName)
{
wil::unique_process_heap_string packageFullName;
Assert::AreEqual(expectedHR, MddGetResolvedPackageFullNameForPackageDependency(packageDependencyId, &packageFullName));
VERIFY_ARE_EQUAL(expectedHR, MddGetResolvedPackageFullNameForPackageDependency(packageDependencyId, &packageFullName));
if (!expectedPackageFullName)
{
Assert::IsTrue(!packageFullName);
VERIFY_IS_TRUE(!packageFullName);
}
else
{
Assert::AreEqual(std::wstring(packageFullName.get()), std::wstring(expectedPackageFullName));
VERIFY_ARE_EQUAL(std::wstring(packageFullName.get()), std::wstring(expectedPackageFullName));
}
}
@ -241,28 +231,28 @@ void Test::DynamicDependency::Test_WinRT::VerifyPathEnvironmentVariable(PCWSTR p
{
std::wstring expectedPath{ path };
std::wstring pathEnvironmentVariable{ wil::TryGetEnvironmentVariableW(L"PATH").get() };
Assert::AreEqual(expectedPath, pathEnvironmentVariable);
VERIFY_ARE_EQUAL(expectedPath, pathEnvironmentVariable);
}
void Test::DynamicDependency::Test_WinRT::VerifyPathEnvironmentVariable(PCWSTR path1, PCWSTR path)
{
std::wstring pathEnvironmentVariable{ wil::TryGetEnvironmentVariableW(L"PATH").get() };
std::wstring expectedPath{ std::wstring(path1) + L";" + path };
Assert::AreEqual(expectedPath, pathEnvironmentVariable);
VERIFY_ARE_EQUAL(expectedPath, pathEnvironmentVariable);
}
void Test::DynamicDependency::Test_WinRT::VerifyPathEnvironmentVariable(PCWSTR path1, PCWSTR path2, PCWSTR path)
{
std::wstring pathEnvironmentVariable{ wil::TryGetEnvironmentVariableW(L"PATH").get() };
std::wstring expectedPath{ std::wstring(path1) + L";" + path2 + L";" + path };
Assert::AreEqual(expectedPath, pathEnvironmentVariable);
VERIFY_ARE_EQUAL(expectedPath, pathEnvironmentVariable);
}
void Test::DynamicDependency::Test_WinRT::VerifyPathEnvironmentVariable(PCWSTR path1, PCWSTR path2, PCWSTR path3, PCWSTR path)
{
std::wstring pathEnvironmentVariable{ wil::TryGetEnvironmentVariableW(L"PATH").get() };
std::wstring expectedPath{ std::wstring(path1) + L";" + path2 + L";" + path3 + L";" + path };
Assert::AreEqual(expectedPath, pathEnvironmentVariable);
VERIFY_ARE_EQUAL(expectedPath, pathEnvironmentVariable);
}
void Test::DynamicDependency::Test_WinRT::VerifyPathEnvironmentVariable(const std::wstring& path1, PCWSTR path)
@ -302,10 +292,10 @@ void Test::DynamicDependency::Test_WinRT::VerifyPackageInPackageGraph(
UINT32 packageInfoCount{};
const PACKAGE_INFO* packageInfo{};
wil::unique_cotaskmem_ptr<BYTE[]> packageInfosBuffer;
Assert::AreEqual(expectedHR, GetCurrentPackageInfo(packageInfoCount, packageInfo, packageInfosBuffer));
VERIFY_ARE_EQUAL(expectedHR, GetCurrentPackageInfo(packageInfoCount, packageInfo, packageInfosBuffer));
if (expectedHR == S_OK)
{
Assert::AreNotEqual(-1, FindPackageFullNameInPackageInfoArray(packageFullName, packageInfoCount, packageInfo));
VERIFY_ARE_NOT_EQUAL(-1, FindPackageFullNameInPackageInfoArray(packageFullName, packageInfoCount, packageInfo));
}
}
@ -316,10 +306,10 @@ void Test::DynamicDependency::Test_WinRT::VerifyPackageNotInPackageGraph(
UINT32 packageInfoCount{};
const PACKAGE_INFO* packageInfo{};
wil::unique_cotaskmem_ptr<BYTE[]> packageInfosBuffer;
Assert::AreEqual(expectedHR, GetCurrentPackageInfo(packageInfoCount, packageInfo, packageInfosBuffer));
VERIFY_ARE_EQUAL(expectedHR, GetCurrentPackageInfo(packageInfoCount, packageInfo, packageInfosBuffer));
if (expectedHR == S_OK)
{
Assert::AreEqual(-1, FindPackageFullNameInPackageInfoArray(packageFullName, packageInfoCount, packageInfo));
VERIFY_ARE_EQUAL(-1, FindPackageFullNameInPackageInfoArray(packageFullName, packageInfoCount, packageInfo));
}
}
@ -409,12 +399,12 @@ winrt::Microsoft::ApplicationModel::DynamicDependency::PackageDependency Test::D
{
winrt::Windows::ApplicationModel::PackageVersion minVersion{};
auto packageDependency{ winrt::Microsoft::ApplicationModel::DynamicDependency::PackageDependency::Create(packageFamilyName, minVersion, options) };
Assert::AreEqual(expectedHR, S_OK);
VERIFY_ARE_EQUAL(expectedHR, S_OK);
return packageDependency;
}
catch (const winrt::hresult_error& e)
{
Assert::AreEqual(static_cast<int32_t>(expectedHR), e.code().value, e.message().c_str());
VERIFY_ARE_EQUAL(static_cast<int32_t>(expectedHR), e.code().value, e.message().c_str());
throw;
}
}
@ -493,12 +483,12 @@ winrt::Microsoft::ApplicationModel::DynamicDependency::PackageDependencyContext
winrt::Microsoft::ApplicationModel::DynamicDependency::AddPackageDependencyOptions options;
options.Rank(rank);
auto packageDependencyContext{ packageDependency.Add(options) };
Assert::AreEqual(expectedHR, S_OK);
VERIFY_ARE_EQUAL(expectedHR, S_OK);
return packageDependencyContext;
}
catch (const winrt::hresult_error& e)
{
Assert::AreEqual(static_cast<int32_t>(expectedHR), e.code().value, e.message().c_str());
VERIFY_ARE_EQUAL(static_cast<int32_t>(expectedHR), e.code().value, e.message().c_str());
throw;
}
}
@ -508,8 +498,8 @@ HANDLE Test::DynamicDependency::Test_WinRT::File_CreateTemporary(
{
wil::unique_hfile file{ ::CreateFileW(filename.c_str(), GENERIC_READ | GENERIC_WRITE, 0,
nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, nullptr)};
Assert::IsTrue(file.is_valid());
Assert::IsTrue(std::filesystem::exists(filename));
VERIFY_IS_TRUE(file.is_valid());
VERIFY_IS_TRUE(std::filesystem::exists(filename));
return file.release();
}
@ -521,7 +511,7 @@ HKEY Test::DynamicDependency::Test_WinRT::Registry_CreateKey(
wil::unique_hkey hkey;
DWORD disposition{};
Assert::AreEqual(ERROR_SUCCESS, ::RegCreateKeyExW(root, subkey, 0, nullptr, REG_OPTION_VOLATILE,
VERIFY_ARE_EQUAL(ERROR_SUCCESS, ::RegCreateKeyExW(root, subkey, 0, nullptr, REG_OPTION_VOLATILE,
KEY_READ | KEY_WRITE, nullptr, wil::out_param(hkey), &disposition));
return hkey.release();
}
@ -533,7 +523,7 @@ void Test::DynamicDependency::Test_WinRT::Registry_DeleteKey(
auto root{ Registry_Key_Parse(key, subkey) };
auto rc{ ::RegDeleteKeyExW(root, subkey, 0, 0) };
Assert::IsTrue((rc == ERROR_SUCCESS) || (rc == ERROR_FILE_NOT_FOUND));
VERIFY_IS_TRUE((rc == ERROR_SUCCESS) || (rc == ERROR_FILE_NOT_FOUND));
}
HKEY Test::DynamicDependency::Test_WinRT::Registry_Key_Parse(
@ -552,8 +542,8 @@ HKEY Test::DynamicDependency::Test_WinRT::Registry_Key_Parse(
{
HKEY root{};
auto offset = key.find(L'\\');
Assert::AreNotEqual(std::wstring::npos, offset);
Assert::AreNotEqual(size_t{0}, offset);
VERIFY_ARE_NOT_EQUAL(std::wstring::npos, offset);
VERIFY_ARE_NOT_EQUAL(size_t{0}, offset);
auto prefix{ key.substr(0, offset) };
if (prefix == L"HKCR")
{
@ -571,8 +561,8 @@ HKEY Test::DynamicDependency::Test_WinRT::Registry_Key_Parse(
{
root = HKEY_USERS;
}
Assert::IsTrue(root != HKEY{});
Assert::IsTrue(key.length() > prefix.length() + 1);
VERIFY_IS_TRUE(root != HKEY{});
VERIFY_IS_TRUE(key.length() > prefix.length() + 1);
offsetToSubkey = ++offset;
return root;
@ -589,7 +579,7 @@ std::wstring Test::DynamicDependency::Test_WinRT::GetPathEnvironmentVariableMinu
const auto pathPrefixLength{ wcslen(pathPrefix) };
auto pathEnvironmentVariable{ GetPathEnvironmentVariable() };
Assert::IsTrue(pathEnvironmentVariable.length() >= pathPrefixLength);
VERIFY_IS_TRUE(pathEnvironmentVariable.length() >= pathPrefixLength);
auto pathMinusPrefix{ pathEnvironmentVariable.c_str() + pathPrefixLength };
if (*pathMinusPrefix == L';')

Просмотреть файл

@ -5,10 +5,16 @@
namespace Test::DynamicDependency
{
TEST_CLASS(Test_WinRT)
class Test_WinRT
{
public:
TEST_CLASS_INITIALIZE(Setup);
BEGIN_TEST_CLASS(Test_WinRT)
//TEST_CLASS_PROPERTY(L"IsolationLevel", L"Method")
TEST_CLASS_PROPERTY(L"ThreadingModel", L"MTA")
//TEST_CLASS_PROPERTY(L"RunFixtureAs:Class", L"RestrictedUser")
END_TEST_CLASS()
TEST_CLASS_SETUP(Setup);
TEST_CLASS_CLEANUP(Cleanup);
TEST_METHOD(Create_Delete);

Просмотреть файл

@ -13,8 +13,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
void Test::DynamicDependency::Test_WinRT::Add_Rank_A0_B10()
{
// Setup our dynamic dependencies
@ -31,9 +29,9 @@ void Test::DynamicDependency::Test_WinRT::Add_Rank_A0_B10()
// -- Create
auto packageDependency_FrameworkMathAdd{ _Create_FrameworkMathAdd() };
Assert::IsFalse(!packageDependency_FrameworkMathAdd);
VERIFY_IS_FALSE(!packageDependency_FrameworkMathAdd);
auto packageDependencyId_FrameworkMathAdd{ packageDependency_FrameworkMathAdd.Id() };
Assert::IsFalse(packageDependencyId_FrameworkMathAdd.empty());
VERIFY_IS_FALSE(packageDependencyId_FrameworkMathAdd.empty());
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -45,8 +43,8 @@ void Test::DynamicDependency::Test_WinRT::Add_Rank_A0_B10()
winrt::Microsoft::ApplicationModel::DynamicDependency::AddPackageDependencyOptions addOptions{};
addOptions.Rank(10);
auto packageDependencyContext_FrameworkMathAdd{ packageDependency_FrameworkMathAdd.Add(addOptions) };
Assert::IsFalse(!packageDependencyContext_FrameworkMathAdd);
Assert::AreEqual(std::wstring(packageDependencyContext_FrameworkMathAdd.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VERIFY_IS_FALSE(!packageDependencyContext_FrameworkMathAdd);
VERIFY_ARE_EQUAL(std::wstring(packageDependencyContext_FrameworkMathAdd.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -62,15 +60,15 @@ void Test::DynamicDependency::Test_WinRT::Add_Rank_A0_B10()
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, mathAddDllFilename) };
Assert::IsNotNull(mathAddDll.get(), message.get());
VERIFY_IS_NOT_NULL(mathAddDll.get(), message.get());
}
auto mathAdd{ GetProcAddressByFunctionDeclaration(mathAddDll.get(), Math_Add) };
Assert::IsNotNull(mathAdd);
VERIFY_IS_NOT_NULL(mathAdd);
const int expectedValue{ 2 + 3 };
const auto actualValue{ mathAdd(2, 3) };
Assert::AreEqual(expectedValue, actualValue);
VERIFY_ARE_EQUAL(expectedValue, actualValue);
// Tear down our dynamic dependencies

Просмотреть файл

@ -13,8 +13,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
void Test::DynamicDependency::Test_WinRT::Add_Rank_Bneg10_A0()
{
// Setup our dynamic dependencies
@ -31,9 +29,9 @@ void Test::DynamicDependency::Test_WinRT::Add_Rank_Bneg10_A0()
// -- Create
auto packageDependency_FrameworkMathAdd{ _Create_FrameworkMathAdd() };
Assert::IsFalse(!packageDependency_FrameworkMathAdd);
VERIFY_IS_FALSE(!packageDependency_FrameworkMathAdd);
auto packageDependencyId_FrameworkMathAdd{ packageDependency_FrameworkMathAdd.Id() };
Assert::IsFalse(packageDependencyId_FrameworkMathAdd.empty());
VERIFY_IS_FALSE(packageDependencyId_FrameworkMathAdd.empty());
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -45,8 +43,8 @@ void Test::DynamicDependency::Test_WinRT::Add_Rank_Bneg10_A0()
winrt::Microsoft::ApplicationModel::DynamicDependency::AddPackageDependencyOptions addOptions{};
addOptions.Rank(-10);
auto packageDependencyContext_FrameworkMathAdd{ packageDependency_FrameworkMathAdd.Add(addOptions) };
Assert::IsFalse(!packageDependencyContext_FrameworkMathAdd);
Assert::AreEqual(std::wstring(packageDependencyContext_FrameworkMathAdd.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VERIFY_IS_FALSE(!packageDependencyContext_FrameworkMathAdd);
VERIFY_ARE_EQUAL(std::wstring(packageDependencyContext_FrameworkMathAdd.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -62,15 +60,15 @@ void Test::DynamicDependency::Test_WinRT::Add_Rank_Bneg10_A0()
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, mathAddDllFilename) };
Assert::IsNotNull(mathAddDll.get(), message.get());
VERIFY_IS_NOT_NULL(mathAddDll.get(), message.get());
}
auto mathAdd{ GetProcAddressByFunctionDeclaration(mathAddDll.get(), Math_Add) };
Assert::IsNotNull(mathAdd);
VERIFY_IS_NOT_NULL(mathAdd);
const int expectedValue{ 2 + 3 };
const auto actualValue{ mathAdd(2, 3) };
Assert::AreEqual(expectedValue, actualValue);
VERIFY_ARE_EQUAL(expectedValue, actualValue);
// Tear down our dynamic dependencies

Просмотреть файл

@ -13,8 +13,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
void Test::DynamicDependency::Test_WinRT::Add_Rank_B0prepend_A0()
{
// Setup our dynamic dependencies
@ -31,9 +29,9 @@ void Test::DynamicDependency::Test_WinRT::Add_Rank_B0prepend_A0()
// -- Create
auto packageDependency_FrameworkMathAdd{ _Create_FrameworkMathAdd() };
Assert::IsFalse(!packageDependency_FrameworkMathAdd);
VERIFY_IS_FALSE(!packageDependency_FrameworkMathAdd);
auto packageDependencyId_FrameworkMathAdd{ packageDependency_FrameworkMathAdd.Id() };
Assert::IsFalse(packageDependencyId_FrameworkMathAdd.empty());
VERIFY_IS_FALSE(packageDependencyId_FrameworkMathAdd.empty());
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -45,8 +43,8 @@ void Test::DynamicDependency::Test_WinRT::Add_Rank_B0prepend_A0()
winrt::Microsoft::ApplicationModel::DynamicDependency::AddPackageDependencyOptions addOptions{};
addOptions.PrependIfRankCollision(true);
auto packageDependencyContext_FrameworkMathAdd{ packageDependency_FrameworkMathAdd.Add(addOptions) };
Assert::IsFalse(!packageDependencyContext_FrameworkMathAdd);
Assert::AreEqual(std::wstring(packageDependencyContext_FrameworkMathAdd.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VERIFY_IS_FALSE(!packageDependencyContext_FrameworkMathAdd);
VERIFY_ARE_EQUAL(std::wstring(packageDependencyContext_FrameworkMathAdd.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -62,15 +60,15 @@ void Test::DynamicDependency::Test_WinRT::Add_Rank_B0prepend_A0()
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, mathAddDllFilename) };
Assert::IsNotNull(mathAddDll.get(), message.get());
VERIFY_IS_NOT_NULL(mathAddDll.get(), message.get());
}
auto mathAdd{ GetProcAddressByFunctionDeclaration(mathAddDll.get(), Math_Add) };
Assert::IsNotNull(mathAdd);
VERIFY_IS_NOT_NULL(mathAdd);
const int expectedValue{ 2 + 3 };
const auto actualValue{ mathAdd(2, 3) };
Assert::AreEqual(expectedValue, actualValue);
VERIFY_ARE_EQUAL(expectedValue, actualValue);
// Tear down our dynamic dependencies

Просмотреть файл

@ -13,8 +13,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
void Test::DynamicDependency::Test_WinRT::Create_Add_Architectures_Current()
{
// Setup our dynamic dependencies
@ -35,9 +33,9 @@ void Test::DynamicDependency::Test_WinRT::Create_Add_Architectures_Current()
// so we exercise the not-default-whatever-deemed-appropriate architecture codepath.
auto architectures{ winrt::Microsoft::ApplicationModel::DynamicDependency::PackageDependencyProcessorArchitectures::Neutral };
auto packageDependency_FrameworkMathAdd{ _Create_FrameworkMathAdd(architectures) };
Assert::IsFalse(!packageDependency_FrameworkMathAdd);
VERIFY_IS_FALSE(!packageDependency_FrameworkMathAdd);
auto packageDependencyId_FrameworkMathAdd{ packageDependency_FrameworkMathAdd.Id() };
Assert::IsFalse(packageDependencyId_FrameworkMathAdd.empty());
VERIFY_IS_FALSE(packageDependencyId_FrameworkMathAdd.empty());
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -47,8 +45,8 @@ void Test::DynamicDependency::Test_WinRT::Create_Add_Architectures_Current()
// -- Add
auto packageDependencyContext_FrameworkMathAdd{ packageDependency_FrameworkMathAdd.Add() };
Assert::IsFalse(!packageDependencyContext_FrameworkMathAdd);
Assert::AreEqual(std::wstring(packageDependencyContext_FrameworkMathAdd.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VERIFY_IS_FALSE(!packageDependencyContext_FrameworkMathAdd);
VERIFY_ARE_EQUAL(std::wstring(packageDependencyContext_FrameworkMathAdd.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -64,15 +62,15 @@ void Test::DynamicDependency::Test_WinRT::Create_Add_Architectures_Current()
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, mathAddDllFilename) };
Assert::IsNotNull(mathAddDll.get(), message.get());
VERIFY_IS_NOT_NULL(mathAddDll.get(), message.get());
}
auto mathAdd{ GetProcAddressByFunctionDeclaration(mathAddDll.get(), Math_Add) };
Assert::IsNotNull(mathAdd);
VERIFY_IS_NOT_NULL(mathAdd);
const int expectedValue{ 2 + 3 };
const auto actualValue{ mathAdd(2, 3) };
Assert::AreEqual(expectedValue, actualValue);
VERIFY_ARE_EQUAL(expectedValue, actualValue);
// Tear down our dynamic dependencies

Просмотреть файл

@ -13,8 +13,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
void Test::DynamicDependency::Test_WinRT::Create_Add_Architectures_Explicit()
{
// Setup our dynamic dependencies
@ -41,9 +39,9 @@ void Test::DynamicDependency::Test_WinRT::Create_Add_Architectures_Explicit()
winrt::Microsoft::ApplicationModel::DynamicDependency::PackageDependencyProcessorArchitectures::Arm64
};
auto packageDependency_FrameworkMathAdd{ _Create_FrameworkMathAdd(architectures) };
Assert::IsFalse(!packageDependency_FrameworkMathAdd);
VERIFY_IS_FALSE(!packageDependency_FrameworkMathAdd);
auto packageDependencyId_FrameworkMathAdd{ packageDependency_FrameworkMathAdd.Id() };
Assert::IsFalse(packageDependencyId_FrameworkMathAdd.empty());
VERIFY_IS_FALSE(packageDependencyId_FrameworkMathAdd.empty());
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -53,8 +51,8 @@ void Test::DynamicDependency::Test_WinRT::Create_Add_Architectures_Explicit()
// -- Add
auto packageDependencyContext_FrameworkMathAdd{ packageDependency_FrameworkMathAdd.Add() };
Assert::IsFalse(!packageDependencyContext_FrameworkMathAdd);
Assert::AreEqual(std::wstring(packageDependencyContext_FrameworkMathAdd.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VERIFY_IS_FALSE(!packageDependencyContext_FrameworkMathAdd);
VERIFY_ARE_EQUAL(std::wstring(packageDependencyContext_FrameworkMathAdd.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -70,15 +68,15 @@ void Test::DynamicDependency::Test_WinRT::Create_Add_Architectures_Explicit()
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, mathAddDllFilename) };
Assert::IsNotNull(mathAddDll.get(), message.get());
VERIFY_IS_NOT_NULL(mathAddDll.get(), message.get());
}
auto mathAdd{ GetProcAddressByFunctionDeclaration(mathAddDll.get(), Math_Add) };
Assert::IsNotNull(mathAdd);
VERIFY_IS_NOT_NULL(mathAdd);
const int expectedValue{ 2 + 3 };
const auto actualValue{ mathAdd(2, 3) };
Assert::AreEqual(expectedValue, actualValue);
VERIFY_ARE_EQUAL(expectedValue, actualValue);
// Tear down our dynamic dependencies

Просмотреть файл

@ -13,8 +13,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
void Test::DynamicDependency::Test_WinRT::Create_DoNotVerifyDependencyResolution()
{
// Setup our dynamic dependencies
@ -32,14 +30,14 @@ void Test::DynamicDependency::Test_WinRT::Create_DoNotVerifyDependencyResolution
// Create a package dependency without verifying its resolution
TP::RemovePackage_FrameworkMathAdd();
Assert::IsFalse(TP::IsPackageRegistered(Test::Packages::FrameworkMathAdd::c_PackageFullName));
VERIFY_IS_FALSE(TP::IsPackageRegistered(Test::Packages::FrameworkMathAdd::c_PackageFullName));
winrt::Microsoft::ApplicationModel::DynamicDependency::CreatePackageDependencyOptions createOptions{};
createOptions.VerifyDependencyResolution(false);
auto packageDependency_FrameworkMathAdd{ _Create_FrameworkMathAdd(createOptions) };
Assert::IsFalse(!packageDependency_FrameworkMathAdd);
VERIFY_IS_FALSE(!packageDependency_FrameworkMathAdd);
auto packageDependencyId_FrameworkMathAdd{ packageDependency_FrameworkMathAdd.Id() };
Assert::IsFalse(packageDependencyId_FrameworkMathAdd.empty());
VERIFY_IS_FALSE(packageDependencyId_FrameworkMathAdd.empty());
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -51,8 +49,8 @@ void Test::DynamicDependency::Test_WinRT::Create_DoNotVerifyDependencyResolution
// -- Add
auto packageDependencyContext_FrameworkMathAdd{ packageDependency_FrameworkMathAdd.Add() };
Assert::IsFalse(!packageDependencyContext_FrameworkMathAdd);
Assert::AreEqual(std::wstring(packageDependencyContext_FrameworkMathAdd.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VERIFY_IS_FALSE(!packageDependencyContext_FrameworkMathAdd);
VERIFY_ARE_EQUAL(std::wstring(packageDependencyContext_FrameworkMathAdd.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -68,15 +66,15 @@ void Test::DynamicDependency::Test_WinRT::Create_DoNotVerifyDependencyResolution
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, mathAddDllFilename) };
Assert::IsNotNull(mathAddDll.get(), message.get());
VERIFY_IS_NOT_NULL(mathAddDll.get(), message.get());
}
auto mathAdd{ GetProcAddressByFunctionDeclaration(mathAddDll.get(), Math_Add) };
Assert::IsNotNull(mathAdd);
VERIFY_IS_NOT_NULL(mathAdd);
const int expectedValue{ 2 + 3 };
const auto actualValue{ mathAdd(2, 3) };
Assert::AreEqual(expectedValue, actualValue);
VERIFY_ARE_EQUAL(expectedValue, actualValue);
// Tear down our dynamic dependencies

Просмотреть файл

@ -13,8 +13,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
void Test::DynamicDependency::Test_WinRT::FullLifecycle_FilePathLifetime_Frameworks_ProjectReunion_MathAdd()
{
// Setup our dynamic dependencies
@ -33,14 +31,14 @@ void Test::DynamicDependency::Test_WinRT::FullLifecycle_FilePathLifetime_Framewo
auto lifetimeArtifactPath{ std::filesystem::temp_directory_path() };
auto lifetimeArtifactFilename{ lifetimeArtifactPath / L"Test-MathAdd-LifetimeArtifact.tmp" };
wil::unique_hfile lifetimeArtifactFile{ File_CreateTemporary(lifetimeArtifactFilename) };
Assert::IsTrue(lifetimeArtifactFile.is_valid());
Assert::IsTrue(std::filesystem::exists(lifetimeArtifactFilename));
VERIFY_IS_TRUE(lifetimeArtifactFile.is_valid());
VERIFY_IS_TRUE(std::filesystem::exists(lifetimeArtifactFilename));
const auto lifetimeArtifactKind{ winrt::Microsoft::ApplicationModel::DynamicDependency::PackageDependencyLifetimeArtifactKind::FilePath };
auto packageDependency_FrameworkMathAdd{ _Create_FrameworkMathAdd(lifetimeArtifactKind, lifetimeArtifactFilename.c_str()) };
Assert::IsFalse(!packageDependency_FrameworkMathAdd);
VERIFY_IS_FALSE(!packageDependency_FrameworkMathAdd);
auto packageDependencyId_FrameworkMathAdd{ packageDependency_FrameworkMathAdd.Id() };
Assert::IsFalse(packageDependencyId_FrameworkMathAdd.empty());
VERIFY_IS_FALSE(packageDependencyId_FrameworkMathAdd.empty());
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -50,10 +48,10 @@ void Test::DynamicDependency::Test_WinRT::FullLifecycle_FilePathLifetime_Framewo
// -- Add
auto packageDependencyContext_FrameworkMathAdd{ packageDependency_FrameworkMathAdd.Add() };
Assert::IsFalse(!packageDependencyContext_FrameworkMathAdd);
VERIFY_IS_FALSE(!packageDependencyContext_FrameworkMathAdd);
LOG_HR_MSG(E_INVALIDARG, "packageDependencyContext_FrameworkMathAdd.PackageFullName(): %ls", packageDependencyContext_FrameworkMathAdd.PackageFullName().c_str());
LOG_HR_MSG(E_INVALIDARG, "expectedPackageFullName_FrameworkMathAdd: %ls", expectedPackageFullName_FrameworkMathAdd.c_str());
Assert::AreEqual(std::wstring(packageDependencyContext_FrameworkMathAdd.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VERIFY_ARE_EQUAL(std::wstring(packageDependencyContext_FrameworkMathAdd.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -64,13 +62,13 @@ void Test::DynamicDependency::Test_WinRT::FullLifecycle_FilePathLifetime_Framewo
// -- Delete the lifetime artifact
lifetimeArtifactFile.reset();
Assert::IsFalse(lifetimeArtifactFile.is_valid());
Assert::IsFalse(std::filesystem::exists(lifetimeArtifactFilename));
VERIFY_IS_FALSE(lifetimeArtifactFile.is_valid());
VERIFY_IS_FALSE(std::filesystem::exists(lifetimeArtifactFilename));
// Add it a 2nd time. The package dependency is deleted but still resolved so this should succeed. PackageGraph = [ Fwk, MathAdd, MathAdd ]
auto context{ packageDependency_FrameworkMathAdd.Add() };
Assert::IsFalse(!context);
Assert::AreEqual(std::wstring(context.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VERIFY_IS_FALSE(!context);
VERIFY_ARE_EQUAL(std::wstring(context.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VerifyPathEnvironmentVariable(packagePath_ProjectReunionFramework, packagePath_FrameworkMathAdd, packagePath_FrameworkMathAdd, pathEnvironmentVariable.c_str());
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, expectedPackageFullName_FrameworkMathAdd);
@ -91,15 +89,15 @@ void Test::DynamicDependency::Test_WinRT::FullLifecycle_FilePathLifetime_Framewo
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, mathAddDllFilename) };
Assert::IsNotNull(mathAddDll.get(), message.get());
VERIFY_IS_NOT_NULL(mathAddDll.get(), message.get());
}
auto mathAdd{ GetProcAddressByFunctionDeclaration(mathAddDll.get(), Math_Add) };
Assert::IsNotNull(mathAdd);
VERIFY_IS_NOT_NULL(mathAdd);
const int expectedValue{ 2 + 3 };
const auto actualValue{ mathAdd(2, 3) };
Assert::AreEqual(expectedValue, actualValue);
VERIFY_ARE_EQUAL(expectedValue, actualValue);
// Tear down our dynamic dependencies

Просмотреть файл

@ -13,8 +13,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
void Test::DynamicDependency::Test_WinRT::FullLifecycle_ProcessLifetime_Frameworks_ProjectReunion_MathAdd()
{
// Setup our dynamic dependencies
@ -31,9 +29,9 @@ void Test::DynamicDependency::Test_WinRT::FullLifecycle_ProcessLifetime_Framewor
// -- Create
auto packageDependency_FrameworkMathAdd{ _Create_FrameworkMathAdd() };
Assert::IsFalse(!packageDependency_FrameworkMathAdd);
VERIFY_IS_FALSE(!packageDependency_FrameworkMathAdd);
auto packageDependencyId_FrameworkMathAdd{ packageDependency_FrameworkMathAdd.Id() };
Assert::IsFalse(packageDependencyId_FrameworkMathAdd.empty());
VERIFY_IS_FALSE(packageDependencyId_FrameworkMathAdd.empty());
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -43,8 +41,8 @@ void Test::DynamicDependency::Test_WinRT::FullLifecycle_ProcessLifetime_Framewor
// -- Add
auto packageDependencyContext_FrameworkMathAdd{ packageDependency_FrameworkMathAdd.Add() };
Assert::IsFalse(!packageDependencyContext_FrameworkMathAdd);
Assert::AreEqual(std::wstring(packageDependencyContext_FrameworkMathAdd.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VERIFY_IS_FALSE(!packageDependencyContext_FrameworkMathAdd);
VERIFY_ARE_EQUAL(std::wstring(packageDependencyContext_FrameworkMathAdd.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -60,15 +58,15 @@ void Test::DynamicDependency::Test_WinRT::FullLifecycle_ProcessLifetime_Framewor
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, mathAddDllFilename) };
Assert::IsNotNull(mathAddDll.get(), message.get());
VERIFY_IS_NOT_NULL(mathAddDll.get(), message.get());
}
auto mathAdd{ GetProcAddressByFunctionDeclaration(mathAddDll.get(), Math_Add) };
Assert::IsNotNull(mathAdd);
VERIFY_IS_NOT_NULL(mathAdd);
const int expectedValue{ 2 + 3 };
const auto actualValue{ mathAdd(2, 3) };
Assert::AreEqual(expectedValue, actualValue);
VERIFY_ARE_EQUAL(expectedValue, actualValue);
// Tear down our dynamic dependencies

Просмотреть файл

@ -13,8 +13,6 @@
namespace TF = ::Test::FileSystem;
namespace TP = ::Test::Packages;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
void Test::DynamicDependency::Test_WinRT::FullLifecycle_RegistryLifetime_Frameworks_ProjectReunion_MathAdd()
{
// Setup our dynamic dependencies
@ -33,14 +31,14 @@ void Test::DynamicDependency::Test_WinRT::FullLifecycle_RegistryLifetime_Framewo
std::wstring lifetimeArtifactRegistryKey{ L"HKCU\\SOFTWARE\\TestProjectReunion-DynamicDependency" };
{
wil::unique_hkey lifetimeArtifactKey{ Registry_CreateKey(lifetimeArtifactRegistryKey) };
Assert::IsTrue(lifetimeArtifactKey.is_valid());
VERIFY_IS_TRUE(lifetimeArtifactKey.is_valid());
}
const auto lifetimeArtifactKind{ winrt::Microsoft::ApplicationModel::DynamicDependency::PackageDependencyLifetimeArtifactKind::RegistryKey};
auto packageDependency_FrameworkMathAdd{ _Create_FrameworkMathAdd(lifetimeArtifactKind, lifetimeArtifactRegistryKey.c_str()) };
Assert::IsFalse(!packageDependency_FrameworkMathAdd);
VERIFY_IS_FALSE(!packageDependency_FrameworkMathAdd);
auto packageDependencyId_FrameworkMathAdd{ packageDependency_FrameworkMathAdd.Id() };
Assert::IsFalse(packageDependencyId_FrameworkMathAdd.empty());
VERIFY_IS_FALSE(packageDependencyId_FrameworkMathAdd.empty());
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -50,8 +48,8 @@ void Test::DynamicDependency::Test_WinRT::FullLifecycle_RegistryLifetime_Framewo
// -- Add
auto packageDependencyContext_FrameworkMathAdd{ packageDependency_FrameworkMathAdd.Add() };
Assert::IsFalse(!packageDependencyContext_FrameworkMathAdd);
Assert::AreEqual(std::wstring(packageDependencyContext_FrameworkMathAdd.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VERIFY_IS_FALSE(!packageDependencyContext_FrameworkMathAdd);
VERIFY_ARE_EQUAL(std::wstring(packageDependencyContext_FrameworkMathAdd.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VerifyPackageInPackageGraph(expectedPackageFullName_ProjectReunionFramework, S_OK);
VerifyPackageInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
@ -65,8 +63,8 @@ void Test::DynamicDependency::Test_WinRT::FullLifecycle_RegistryLifetime_Framewo
// Add it a 2nd time. The package dependency is deleted but still resolved so this should succeed. PackageGraph = [ Fwk, MathAdd, MathAdd ]
auto context{ packageDependency_FrameworkMathAdd.Add() };
Assert::IsFalse(!context);
Assert::AreEqual(std::wstring(context.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VERIFY_IS_FALSE(!context);
VERIFY_ARE_EQUAL(std::wstring(context.PackageFullName()), std::wstring(expectedPackageFullName_FrameworkMathAdd));
VerifyPathEnvironmentVariable(packagePath_ProjectReunionFramework, packagePath_FrameworkMathAdd, packagePath_FrameworkMathAdd, pathEnvironmentVariable.c_str());
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, expectedPackageFullName_FrameworkMathAdd);
@ -87,15 +85,15 @@ void Test::DynamicDependency::Test_WinRT::FullLifecycle_RegistryLifetime_Framewo
{
const auto lastError{ GetLastError() };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Error in LoadLibrary: %d (0x%X) loading %s", lastError, lastError, mathAddDllFilename) };
Assert::IsNotNull(mathAddDll.get(), message.get());
VERIFY_IS_NOT_NULL(mathAddDll.get(), message.get());
}
auto mathAdd{ GetProcAddressByFunctionDeclaration(mathAddDll.get(), Math_Add) };
Assert::IsNotNull(mathAdd);
VERIFY_IS_NOT_NULL(mathAdd);
const int expectedValue{ 2 + 3 };
const auto actualValue{ mathAdd(2, 3) };
Assert::AreEqual(expectedValue, actualValue);
VERIFY_ARE_EQUAL(expectedValue, actualValue);
// Tear down our dynamic dependencies

Просмотреть файл

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Taef" version="10.58.210222006-develop" targetFramework="native" />
</packages>

Просмотреть файл

@ -32,10 +32,8 @@
#include <MddBootstrap.h>
#include <MddBootstrapTest.h>
#include "CppUnitTest.h"
#include "CppUnitTestX.h"
#include <WexTestClass.h>
#include "TestCom.h"
#include "TestFilesystem.h"
#include "TestPackages.h"

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props')" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
@ -337,16 +337,16 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200703.9\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210204.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.210403.2\build\native\Microsoft.Windows.CppWinRT.targets'))" />
</Target>
<Target Name="CopyFiles" AfterTargets="AfterBuild">
<Copy SourceFiles="$(OutDir)\..\ProjectReunion_BootstrapDLL\Microsoft.ProjectReunion.Bootstrap.dll" DestinationFolder="$(OutDir)" />

Просмотреть файл

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.201113.7" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.200519.2" targetFramework="native" />
</packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.210403.2" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.210204.1" targetFramework="native" />
</packages>