1
0
This repository has been archived on 2025-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
Files
siadrive/UnitTests/SiaWalletApiTests.cpp
Scott E. Graves 354404f71b Pass drive config
2017-02-19 14:34:41 -06:00

42 lines
1.1 KiB
C++

#include "stdafx.h"
#include "CppUnitTest.h"
#include <SiaApi.h>
#include "UnitTestConfig.h"
#include "SiaDriveConfig.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace UnitTests
{
TEST_CLASS(SiaWalletApi)
{
DAEMON_TEST()
private:
CSiaDriveConfig _driveConfig;
CSiaApi _api = CSiaApi({ TEST_SERVER_AND_PORT, TEST_SERVER_VERSION }, &_driveConfig);
public:
TEST_METHOD(CreateWalletAndUnlockWithEnglishSeedAndLock)
{
CSiaWalletPtr wallet = _api.GetWallet();
Assert::IsNotNull(wallet.get());
Assert::IsFalse(wallet->GetCreated());
Assert::IsTrue(wallet->GetLocked());
String seed;
Assert::IsTrue(ApiSuccess(wallet->Create(SiaSeedLanguage::English, seed)));
Assert::IsTrue(wallet->GetCreated());
Assert::IsTrue(wallet->GetLocked());
Assert::IsTrue(ApiSuccess(wallet->Unlock(seed)));
Assert::IsTrue(wallet->GetCreated());
Assert::IsFalse(wallet->GetLocked());
Assert::IsTrue(ApiSuccess(wallet->Lock( )));
Assert::IsTrue(wallet->GetCreated());
Assert::IsTrue(wallet->GetLocked());
}
};
DEFINE_DAEMON(SiaWalletApi);
}