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
2017-03-13 15:27:23 -05:00

42 lines
1.1 KiB
C++

#include "stdafx.h"
#include <SiaApi.h>
#include "UnitTestConfig.h"
#include "SiaDriveConfig.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace Sia::Api;
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);
}