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 43b301f0bc More changes
2017-02-04 00:51:43 -06:00

47 lines
1.2 KiB
C++

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