mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
Co-authored-by: Alexis Campailla <alexis@janeasystems.com> Co-authored-by: Bret Anderson <bretan@microsoft.com> Co-authored-by: Enrico Giordani <enrico.giordani@gmail.com> Co-authored-by: Jaime Bernardo <jaime@janeasystems.com> Co-authored-by: Jeff Bogdan <jeffbog@microsoft.com> Co-authored-by: March Rogers <marchr@microsoft.com> Co-authored-by: Mike Harsh <mharsh@microsoft.com> Co-authored-by: Nachum Bundak <Nachum.Bundak@microsoft.com> Co-authored-by: Oliver Jones <ojones@microsoft.com> Co-authored-by: Patrick Little <plittle@microsoft.com>
37 lines
1.1 KiB
C++
37 lines
1.1 KiB
C++
#include "pch.h"
|
|
#include "lib\RegistryHelpers.h"
|
|
|
|
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
|
|
|
namespace FancyZonesUnitTests
|
|
{
|
|
TEST_CLASS(RegistryHelpersUnitTests)
|
|
{
|
|
public:
|
|
TEST_METHOD(GetDefaultKey)
|
|
{
|
|
// Test the path to the key is the same string.
|
|
wchar_t key[256];
|
|
Assert::AreEqual(0, wcscmp(RegistryHelpers::GetKey(nullptr, key, ARRAYSIZE(key)), L"Software\\SuperFancyZones"));
|
|
}
|
|
|
|
TEST_METHOD(GetKeyWithMonitor)
|
|
{
|
|
// Test the path to the key is the same string.
|
|
wchar_t key[256];
|
|
Assert::AreEqual(0, wcscmp(RegistryHelpers::GetKey(L"Monitor1", key, ARRAYSIZE(key)), L"Software\\SuperFancyZones\\Monitor1"));
|
|
}
|
|
|
|
TEST_METHOD(OpenKey)
|
|
{
|
|
// The default key should exist.
|
|
wil::unique_hkey key{ RegistryHelpers::OpenKey({}) };
|
|
Assert::IsNotNull(key.get());
|
|
|
|
// The Monitor1 key shouldn't exist.
|
|
wil::unique_hkey key2{ RegistryHelpers::OpenKey(L"Monitor1") };
|
|
Assert::IsNull(key2.get());
|
|
}
|
|
};
|
|
}
|