Use guid for temp directories and delete them after tests (#963)
This commit is contained in:
parent
b12c9b33f7
commit
9d1ffa2d06
|
|
@ -101,7 +101,7 @@
|
|||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<AdditionalLibraryDirectories>..\..\src\AspNetCoreModuleV2\InProcessRequestHandler\$(Configuration)\;</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;inprocessapplication.obj;inprocesshandler.obj;ahadmin.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;inprocessapplication.obj;inprocesshandler.obj;ahadmin.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<Lib>
|
||||
<AdditionalDependencies>
|
||||
|
|
@ -127,7 +127,7 @@
|
|||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<AdditionalLibraryDirectories>..\..\src\AspNetCoreModuleV2\InProcessRequestHandler\x64\$(Configuration)\;</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;inprocessapplication.obj;inprocesshandler.obj;ahadmin.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;inprocessapplication.obj;inprocesshandler.obj;ahadmin.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<Lib>
|
||||
<AdditionalDependencies>
|
||||
|
|
@ -153,7 +153,7 @@
|
|||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<AdditionalLibraryDirectories>..\..\src\AspNetCoreModuleV2\InProcessRequestHandler\$(Configuration)\;</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;inprocessapplication.obj;inprocesshandler.obj;ahadmin.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;inprocessapplication.obj;inprocesshandler.obj;ahadmin.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<Lib>
|
||||
<AdditionalDependencies>
|
||||
|
|
@ -179,7 +179,7 @@
|
|||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<AdditionalLibraryDirectories>..\..\src\AspNetCoreModuleV2\InProcessRequestHandler\x64\$(Configuration)\;</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;inprocessapplication.obj;inprocesshandler.obj;ahadmin.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;inprocessapplication.obj;inprocesshandler.obj;ahadmin.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<Lib>
|
||||
<AdditionalDependencies>
|
||||
|
|
|
|||
|
|
@ -31,16 +31,16 @@ namespace FileOutManagerStartupTests
|
|||
{
|
||||
PCWSTR expected = L"test";
|
||||
|
||||
std::wstring tempDirectory = Helpers::CreateRandomTempDirectory();
|
||||
auto tempDirectory = TempDirectory();
|
||||
FileOutputManager* pManager = new FileOutputManager;
|
||||
pManager->Initialize(fileNamePrefix.c_str(), tempDirectory.c_str());
|
||||
pManager->Initialize(fileNamePrefix.c_str(), tempDirectory.path().c_str());
|
||||
{
|
||||
FileManagerWrapper wrapper(pManager);
|
||||
|
||||
wprintf(expected, out);
|
||||
}
|
||||
|
||||
for (auto & p : std::experimental::filesystem::directory_iterator(tempDirectory))
|
||||
|
||||
for (auto & p : std::experimental::filesystem::directory_iterator(tempDirectory.path()))
|
||||
{
|
||||
std::wstring filename(p.path().filename());
|
||||
ASSERT_EQ(filename.substr(0, fileNamePrefix.size()), fileNamePrefix);
|
||||
|
|
@ -49,8 +49,6 @@ namespace FileOutManagerStartupTests
|
|||
ASSERT_EQ(content.length(), DWORD(4));
|
||||
ASSERT_STREQ(content.c_str(), expected);
|
||||
}
|
||||
|
||||
Helpers::DeleteDirectory(tempDirectory);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -74,10 +72,10 @@ namespace FileOutManagerOutputTests
|
|||
{
|
||||
PCSTR expected = "test";
|
||||
|
||||
std::wstring tempDirectory = Helpers::CreateRandomTempDirectory();
|
||||
auto tempDirectory = TempDirectory();
|
||||
|
||||
FileOutputManager* pManager = new FileOutputManager;
|
||||
pManager->Initialize(L"", tempDirectory.c_str());
|
||||
pManager->Initialize(L"", tempDirectory.path().c_str());
|
||||
{
|
||||
FileManagerWrapper wrapper(pManager);
|
||||
|
||||
|
|
@ -87,18 +85,16 @@ namespace FileOutManagerOutputTests
|
|||
|
||||
ASSERT_STREQ(straContent.QueryStr(), expected);
|
||||
}
|
||||
|
||||
Helpers::DeleteDirectory(tempDirectory);
|
||||
}
|
||||
|
||||
TEST(FileOutManagerOutputTest, DISABLED_CheckFileOutput)
|
||||
{
|
||||
PCSTR expected = "test";
|
||||
|
||||
std::wstring tempDirectory = Helpers::CreateRandomTempDirectory();
|
||||
auto tempDirectory = TempDirectory();
|
||||
|
||||
FileOutputManager* pManager = new FileOutputManager;
|
||||
pManager->Initialize(L"", tempDirectory.c_str());
|
||||
pManager->Initialize(L"", tempDirectory.path().c_str());
|
||||
{
|
||||
FileManagerWrapper wrapper(pManager);
|
||||
|
||||
|
|
@ -108,18 +104,16 @@ namespace FileOutManagerOutputTests
|
|||
|
||||
ASSERT_STREQ(straContent.QueryStr(), expected);
|
||||
}
|
||||
|
||||
Helpers::DeleteDirectory(tempDirectory);
|
||||
}
|
||||
|
||||
TEST(FileOutManagerOutputTest, DISABLED_CapAt4KB)
|
||||
{
|
||||
PCSTR expected = "test";
|
||||
|
||||
std::wstring tempDirectory = Helpers::CreateRandomTempDirectory();
|
||||
auto tempDirectory = TempDirectory();
|
||||
|
||||
FileOutputManager* pManager = new FileOutputManager;
|
||||
pManager->Initialize(L"", tempDirectory.c_str());
|
||||
pManager->Initialize(L"", tempDirectory.path().c_str());
|
||||
{
|
||||
FileManagerWrapper wrapper(pManager);
|
||||
|
||||
|
|
@ -133,8 +127,6 @@ namespace FileOutManagerOutputTests
|
|||
|
||||
ASSERT_EQ(straContent.QueryCCH(), 4096);
|
||||
}
|
||||
|
||||
Helpers::DeleteDirectory(tempDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,32 +30,32 @@ namespace GlobalVersionTests
|
|||
|
||||
TEST(GetRequestHandlerVersions, GetFolders)
|
||||
{
|
||||
std::wstring tempPath = Helpers::CreateRandomTempDirectory();
|
||||
EXPECT_TRUE(fs::create_directories(tempPath + L"\\2.0.0"));
|
||||
auto tempPath = TempDirectory();
|
||||
EXPECT_TRUE(fs::create_directories(tempPath.path() / L"2.0.0"));
|
||||
|
||||
auto res = GlobalVersionUtility::GetRequestHandlerVersions(tempPath.c_str());
|
||||
auto res = GlobalVersionUtility::GetRequestHandlerVersions(tempPath.path().c_str());
|
||||
EXPECT_EQ(res.size(), 1);
|
||||
EXPECT_EQ(res.at(0), fx_ver_t(2, 0, 0, std::wstring()));
|
||||
}
|
||||
|
||||
TEST(GetRequestHandlerVersions, GetFolderPreview)
|
||||
{
|
||||
std::wstring tempPath = Helpers::CreateRandomTempDirectory();
|
||||
EXPECT_TRUE(fs::create_directories(tempPath + L"\\2.0.0-preview"));
|
||||
auto tempPath = TempDirectory();
|
||||
EXPECT_TRUE(fs::create_directories(tempPath.path() / L"2.0.0-preview"));
|
||||
|
||||
auto res = GlobalVersionUtility::GetRequestHandlerVersions(tempPath.c_str());
|
||||
auto res = GlobalVersionUtility::GetRequestHandlerVersions(tempPath.path().c_str());
|
||||
EXPECT_EQ(res.size(), 1);
|
||||
EXPECT_EQ(res.at(0), fx_ver_t(2, 0, 0, std::wstring(L"-preview")));
|
||||
}
|
||||
|
||||
TEST(GetRequestHandlerVersions, GetFolderManyVersions)
|
||||
{
|
||||
std::wstring tempPath = Helpers::CreateRandomTempDirectory();
|
||||
EXPECT_TRUE(fs::create_directories(tempPath + L"\\2.0.0"));
|
||||
EXPECT_TRUE(fs::create_directories(tempPath + L"\\1.9.0"));
|
||||
EXPECT_TRUE(fs::create_directories(tempPath + L"\\2.1.0"));
|
||||
auto tempPath = TempDirectory();
|
||||
EXPECT_TRUE(fs::create_directories(tempPath.path() / + L"2.0.0"));
|
||||
EXPECT_TRUE(fs::create_directories(tempPath.path() / + L"1.9.0"));
|
||||
EXPECT_TRUE(fs::create_directories(tempPath.path() / + L"2.1.0"));
|
||||
|
||||
auto res = GlobalVersionUtility::GetRequestHandlerVersions(tempPath.c_str());
|
||||
auto res = GlobalVersionUtility::GetRequestHandlerVersions(tempPath.path().c_str());
|
||||
EXPECT_EQ(res.size(), 3);
|
||||
EXPECT_TRUE(std::find(res.begin(), res.end(), fx_ver_t(1, 9, 0, std::wstring())) != std::end(res));
|
||||
EXPECT_TRUE(std::find(res.begin(), res.end(), fx_ver_t(2, 0, 0, std::wstring())) != std::end(res));
|
||||
|
|
@ -64,90 +64,90 @@ namespace GlobalVersionTests
|
|||
|
||||
TEST(FindHighestGlobalVersion, HighestVersionWithSingleFolder)
|
||||
{
|
||||
std::wstring tempPath = Helpers::CreateRandomTempDirectory();
|
||||
EXPECT_TRUE(fs::create_directories(tempPath + L"\\2.0.0"));
|
||||
auto tempPath = TempDirectory();
|
||||
EXPECT_TRUE(fs::create_directories(tempPath.path() / "2.0.0"));
|
||||
|
||||
auto res = GlobalVersionUtility::FindHighestGlobalVersion(tempPath.c_str());
|
||||
auto res = GlobalVersionUtility::FindHighestGlobalVersion(tempPath.path().c_str());
|
||||
|
||||
EXPECT_STREQ(res.c_str(), L"2.0.0");
|
||||
}
|
||||
|
||||
TEST(FindHighestGlobalVersion, HighestVersionWithMultipleVersions)
|
||||
{
|
||||
std::wstring tempPath = Helpers::CreateRandomTempDirectory();
|
||||
EXPECT_TRUE(fs::create_directories(tempPath + L"\\2.0.0"));
|
||||
EXPECT_TRUE(fs::create_directories(tempPath + L"\\2.1.0"));
|
||||
auto tempPath = TempDirectory();
|
||||
EXPECT_TRUE(fs::create_directories(tempPath.path() / "2.0.0"));
|
||||
EXPECT_TRUE(fs::create_directories(tempPath.path() / "2.1.0"));
|
||||
|
||||
auto res = GlobalVersionUtility::FindHighestGlobalVersion(tempPath.c_str());
|
||||
auto res = GlobalVersionUtility::FindHighestGlobalVersion(tempPath.path().c_str());
|
||||
|
||||
EXPECT_STREQ(res.c_str(), L"2.1.0");
|
||||
}
|
||||
|
||||
TEST(FindHighestGlobalVersion, HighestVersionWithMultipleVersionsPreview)
|
||||
{
|
||||
std::wstring tempPath = Helpers::CreateRandomTempDirectory();
|
||||
EXPECT_TRUE(fs::create_directories(tempPath + L"\\2.0.0"));
|
||||
EXPECT_TRUE(fs::create_directories(tempPath + L"\\2.1.0"));
|
||||
EXPECT_TRUE(fs::create_directories(tempPath + L"\\2.2.0-preview"));
|
||||
auto tempPath = TempDirectory();
|
||||
EXPECT_TRUE(fs::create_directories(tempPath.path() / "2.0.0"));
|
||||
EXPECT_TRUE(fs::create_directories(tempPath.path() / "2.1.0"));
|
||||
EXPECT_TRUE(fs::create_directories(tempPath.path() / "2.2.0-preview"));
|
||||
|
||||
auto res = GlobalVersionUtility::FindHighestGlobalVersion(tempPath.c_str());
|
||||
auto res = GlobalVersionUtility::FindHighestGlobalVersion(tempPath.path().c_str());
|
||||
|
||||
EXPECT_STREQ(res.c_str(), L"2.2.0-preview");
|
||||
}
|
||||
|
||||
TEST(FindHighestGlobalVersion, HighestVersionWithMultipleVersionNoPreview)
|
||||
{
|
||||
std::wstring tempPath = Helpers::CreateRandomTempDirectory();
|
||||
EXPECT_TRUE(fs::create_directories(tempPath + L"\\2.0.0"));
|
||||
EXPECT_TRUE(fs::create_directories(tempPath + L"\\2.1.0-preview"));
|
||||
EXPECT_TRUE(fs::create_directories(tempPath + L"\\2.1.0"));
|
||||
auto tempPath = TempDirectory();
|
||||
EXPECT_TRUE(fs::create_directories(tempPath.path() / "2.0.0"));
|
||||
EXPECT_TRUE(fs::create_directories(tempPath.path() / "2.1.0-preview"));
|
||||
EXPECT_TRUE(fs::create_directories(tempPath.path() / "2.1.0"));
|
||||
|
||||
auto res = GlobalVersionUtility::FindHighestGlobalVersion(tempPath.c_str());
|
||||
auto res = GlobalVersionUtility::FindHighestGlobalVersion(tempPath.path().c_str());
|
||||
|
||||
EXPECT_STREQ(res.c_str(), L"2.1.0");
|
||||
}
|
||||
|
||||
TEST(GetGlobalRequestHandlerPath, FindHighestVersionNoHandlerName)
|
||||
{
|
||||
std::wstring tempPath = Helpers::CreateRandomTempDirectory();
|
||||
EXPECT_TRUE(fs::create_directories(tempPath + L"\\2.0.0"));
|
||||
auto result = GlobalVersionUtility::GetGlobalRequestHandlerPath(tempPath.c_str(), L"", L"aspnetcorev2_outofprocess.dll");
|
||||
auto tempPath = TempDirectory();
|
||||
EXPECT_TRUE(fs::create_directories(tempPath.path() / "2.0.0"));
|
||||
auto result = GlobalVersionUtility::GetGlobalRequestHandlerPath(tempPath.path().c_str(), L"", L"aspnetcorev2_outofprocess.dll");
|
||||
|
||||
EXPECT_STREQ(result.c_str(), (tempPath + L"2.0.0\\aspnetcorev2_outofprocess.dll").c_str());
|
||||
EXPECT_STREQ(result.c_str(), (tempPath.path() / L"2.0.0\\aspnetcorev2_outofprocess.dll").c_str());
|
||||
}
|
||||
|
||||
TEST(GetGlobalRequestHandlerPath, FindHighestVersionPreviewWins)
|
||||
{
|
||||
std::wstring tempPath = Helpers::CreateRandomTempDirectory();
|
||||
EXPECT_TRUE(fs::create_directories(tempPath + L"\\2.0.0"));
|
||||
EXPECT_TRUE(fs::create_directories(tempPath + L"\\2.1.0-preview"));
|
||||
auto tempPath = TempDirectory();
|
||||
EXPECT_TRUE(fs::create_directories(tempPath.path() / "2.0.0"));
|
||||
EXPECT_TRUE(fs::create_directories(tempPath.path() / "2.1.0-preview"));
|
||||
|
||||
auto result = GlobalVersionUtility::GetGlobalRequestHandlerPath(tempPath.c_str(), L"", L"aspnetcorev2_outofprocess.dll");
|
||||
auto result = GlobalVersionUtility::GetGlobalRequestHandlerPath(tempPath.path().c_str(), L"", L"aspnetcorev2_outofprocess.dll");
|
||||
|
||||
EXPECT_STREQ(result.c_str(), (tempPath + L"2.1.0-preview\\aspnetcorev2_outofprocess.dll").c_str());
|
||||
EXPECT_STREQ(result.c_str(), (tempPath.path() / L"2.1.0-preview\\aspnetcorev2_outofprocess.dll").c_str());
|
||||
}
|
||||
|
||||
TEST(GetGlobalRequestHandlerPath, FindHighestVersionSpecificVersion)
|
||||
{
|
||||
std::wstring tempPath = Helpers::CreateRandomTempDirectory();
|
||||
EXPECT_TRUE(fs::create_directories(tempPath + L"\\2.0.0"));
|
||||
EXPECT_TRUE(fs::create_directories(tempPath + L"\\2.1.0-preview"));
|
||||
auto tempPath = TempDirectory();
|
||||
EXPECT_TRUE(fs::create_directories(tempPath.path() / "2.0.0"));
|
||||
EXPECT_TRUE(fs::create_directories(tempPath.path() / "2.1.0-preview"));
|
||||
|
||||
auto result = GlobalVersionUtility::GetGlobalRequestHandlerPath(tempPath.c_str(), L"2.0.0", L"aspnetcorev2_outofprocess.dll");
|
||||
auto result = GlobalVersionUtility::GetGlobalRequestHandlerPath(tempPath.path().c_str(), L"2.0.0", L"aspnetcorev2_outofprocess.dll");
|
||||
|
||||
EXPECT_STREQ(result.c_str(), (tempPath + L"2.0.0\\aspnetcorev2_outofprocess.dll").c_str());
|
||||
EXPECT_STREQ(result.c_str(), (tempPath.path() / L"2.0.0\\aspnetcorev2_outofprocess.dll").c_str());
|
||||
}
|
||||
|
||||
TEST(GetGlobalRequestHandlerPath, FindHighestVersionSpecificPreview)
|
||||
{
|
||||
std::wstring tempPath = Helpers::CreateRandomTempDirectory();
|
||||
EXPECT_TRUE(fs::create_directories(tempPath + L"\\2.0.0"));
|
||||
EXPECT_TRUE(fs::create_directories(tempPath + L"\\2.1.0-preview"));
|
||||
EXPECT_TRUE(fs::create_directories(tempPath + L"\\2.2.0"));
|
||||
auto tempPath = TempDirectory();
|
||||
EXPECT_TRUE(fs::create_directories(tempPath.path() / "2.0.0"));
|
||||
EXPECT_TRUE(fs::create_directories(tempPath.path() / "2.1.0-preview"));
|
||||
EXPECT_TRUE(fs::create_directories(tempPath.path() / "2.2.0"));
|
||||
|
||||
|
||||
auto result = GlobalVersionUtility::GetGlobalRequestHandlerPath(tempPath.c_str(), L"2.1.0-preview", L"aspnetcorev2_outofprocess.dll");
|
||||
auto result = GlobalVersionUtility::GetGlobalRequestHandlerPath(tempPath.path().c_str(), L"2.1.0-preview", L"aspnetcorev2_outofprocess.dll");
|
||||
|
||||
EXPECT_STREQ(result.c_str(), (tempPath + L"2.1.0-preview\\aspnetcorev2_outofprocess.dll").c_str());
|
||||
EXPECT_STREQ(result.c_str(), (tempPath.path() / L"2.1.0-preview\\aspnetcorev2_outofprocess.dll").c_str());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,29 +3,6 @@
|
|||
|
||||
#include "stdafx.h"
|
||||
|
||||
std::wstring
|
||||
Helpers::CreateRandomValue()
|
||||
{
|
||||
int randomValue = rand();
|
||||
return std::to_wstring(randomValue);
|
||||
}
|
||||
|
||||
std::wstring
|
||||
Helpers::CreateRandomTempDirectory()
|
||||
{
|
||||
PWSTR tempPath = new WCHAR[256];
|
||||
GetTempPath(256, tempPath);
|
||||
std::wstring wstringPath(tempPath);
|
||||
|
||||
return wstringPath.append(Helpers::CreateRandomValue()).append(L"\\");
|
||||
}
|
||||
|
||||
void
|
||||
Helpers::DeleteDirectory(std::wstring directory)
|
||||
{
|
||||
std::experimental::filesystem::remove_all(directory);
|
||||
}
|
||||
|
||||
std::wstring
|
||||
Helpers::ReadFileContent(std::wstring file)
|
||||
{
|
||||
|
|
@ -37,12 +14,28 @@ Helpers::ReadFileContent(std::wstring file)
|
|||
|
||||
int nChars = MultiByteToWideChar(CP_ACP, 0, buffer.str().c_str(), -1, NULL, 0);
|
||||
|
||||
LPWSTR pwzName = new WCHAR[nChars];
|
||||
MultiByteToWideChar(CP_UTF8, 0, buffer.str().c_str(), -1, pwzName, nChars);
|
||||
std::wstring retVal(nChars, '\0');
|
||||
|
||||
std::wstring retVal(pwzName);
|
||||
|
||||
delete pwzName;
|
||||
MultiByteToWideChar(CP_UTF8, 0, buffer.str().c_str(), -1, retVal.data(), nChars);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
TempDirectory::TempDirectory()
|
||||
{
|
||||
UUID uuid;
|
||||
UuidCreate(&uuid);
|
||||
RPC_CSTR szUuid = NULL;
|
||||
if (UuidToStringA(&uuid, &szUuid) == RPC_S_OK)
|
||||
{
|
||||
m_path = std::experimental::filesystem::temp_directory_path() / szUuid;
|
||||
RpcStringFreeA(&szUuid);
|
||||
return;
|
||||
}
|
||||
throw std::exception("Cannot create temp directory");
|
||||
}
|
||||
|
||||
TempDirectory::~TempDirectory()
|
||||
{
|
||||
std::experimental::filesystem::remove_all(m_path);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,21 +5,24 @@
|
|||
class Helpers
|
||||
{
|
||||
public:
|
||||
|
||||
static
|
||||
std::wstring
|
||||
CreateRandomValue();
|
||||
|
||||
static
|
||||
std::wstring
|
||||
CreateRandomTempDirectory();
|
||||
|
||||
static
|
||||
void
|
||||
DeleteDirectory(std::wstring directory);
|
||||
|
||||
static
|
||||
std::wstring
|
||||
ReadFileContent(std::wstring file);
|
||||
};
|
||||
|
||||
class TempDirectory
|
||||
{
|
||||
public:
|
||||
|
||||
TempDirectory();
|
||||
|
||||
~TempDirectory();
|
||||
|
||||
std::experimental::filesystem::path path() const
|
||||
{
|
||||
return m_path;
|
||||
}
|
||||
|
||||
private:
|
||||
std::experimental::filesystem::path m_path;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,14 +5,8 @@
|
|||
|
||||
DECLARE_DEBUG_PRINT_OBJECT2("tests", ASPNETCORE_DEBUG_FLAG_INFO | ASPNETCORE_DEBUG_FLAG_CONSOLE);
|
||||
|
||||
#if defined(_WIN32)
|
||||
int wmain(int argc, wchar_t* argv[])
|
||||
#else
|
||||
int main(int argc, char* argv[])
|
||||
#endif
|
||||
{
|
||||
std::srand((unsigned int)std::time(0));
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
RUN_ALL_TESTS();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue