Mock siad changes
This commit is contained in:
@@ -14,7 +14,7 @@ namespace UnitTests
|
||||
{
|
||||
private:
|
||||
const SiaHostConfig hostConfig = { L"localhost", 19980, L"1.1.0" };
|
||||
std::unique_ptr<CMockSiad> siad;
|
||||
static std::unique_ptr<CMockSiad> siad;
|
||||
|
||||
public:
|
||||
TEST_METHOD_INITIALIZE(Initialize)
|
||||
@@ -22,7 +22,12 @@ namespace UnitTests
|
||||
siad.reset(new CMockSiad(hostConfig));
|
||||
}
|
||||
|
||||
TEST_METHOD_CLEANUP(Cleanup)
|
||||
TEST_METHOD_CLEANUP(DestroyTest)
|
||||
{
|
||||
siad->Stop();
|
||||
}
|
||||
|
||||
TEST_CLASS_CLEANUP(DestroyClass)
|
||||
{
|
||||
siad->Stop();
|
||||
}
|
||||
@@ -30,11 +35,24 @@ namespace UnitTests
|
||||
TEST_METHOD(TestMethod1)
|
||||
{
|
||||
siad->Start(SiadTestType::UploadFile);
|
||||
Sleep(2000);
|
||||
CSiaDriveConfig driveConfig;
|
||||
CSiaCurl siaCurl(hostConfig);
|
||||
siaCurl.GetServerVersion();
|
||||
CUploadManager uploadManager(siaCurl, &driveConfig);
|
||||
try
|
||||
{
|
||||
CSiaDriveConfig driveConfig;
|
||||
CSiaCurl siaCurl(hostConfig);
|
||||
String version = siaCurl.GetServerVersion();
|
||||
|
||||
CUploadManager uploadManager(siaCurl, &driveConfig);
|
||||
uploadManager.AddOrUpdate(L"/test1/test.txt", L"./test1/test.txt");
|
||||
}
|
||||
catch (SQLite::Exception e)
|
||||
{
|
||||
siad->Stop();
|
||||
throw;
|
||||
}
|
||||
|
||||
siad->Stop();
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<CMockSiad> UnitTests::siad;
|
||||
}
|
Reference in New Issue
Block a user