private void TestFullHashToId() { using (Logger = new TestsessionLogger(_logger)) { const ulong expected = 15471138873922485091; const long expectedLong = unchecked ((long)expected); var fullHashToIdResult = _service.FullHashToId("63fbe212d686b4d6fb2cb316058fd983e577d3ad3ffeaa5b904afe5ff2ff9f66").Result; if (fullHashToIdResult.Id != expected) { Logger.Fail($"Expected: {expected}, but got: {fullHashToIdResult.Id}"); } if (fullHashToIdResult.LongId != expectedLong) { Logger.Fail($"Expected: {expectedLong}, but got: {fullHashToIdResult.LongId}"); } } }
private void TestDecodeQrCode() { using (Logger = new TestsessionLogger(_logger)) { var decodeQrCodeResult = _service.DecodeQrCode(QrCodeBase64).Result; if (decodeQrCodeResult.QrCodeData != NxtAddress) { Logger.Fail($"Expected: {NxtAddress}, but got {decodeQrCodeResult.QrCodeData}"); } } }
private void TestEncodeQrCode() { using (Logger = new TestsessionLogger(_logger)) { var encodeQrCodeResult = _service.EncodeQrCode(NxtAddress).Result; if (encodeQrCodeResult.QrCodeBase64 != QrCodeBase64) { Logger.Fail($"Expected: {QrCodeBase64}, but got {encodeQrCodeResult.QrCodeBase64}"); } } }
private void EventRegisterTest() { using (Logger = new TestsessionLogger(_logger)) { var eventRegisterResponse = _serverInfoService.EventRegister().Result; if (!eventRegisterResponse.Registered) { Logger.Fail("EventRegister.Registered is false"); } } }
private void TestHash() { using (Logger = new TestsessionLogger(_logger)) { const string expected = "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"; var result = _service.Hash(HashAlgorithm.Sha256, new BinaryHexString("abc123"), true).Result; if (!result.Hash.ToString().Equals(expected)) { Logger.Fail($"Expected: {expected}, but got: {result.Hash}"); } } }
private void TestGeneratePassword() { using (Logger = new TestsessionLogger(_logger)) { try { _localPasswordGenerator.GeneratePassword(1); Logger.Fail("No ArgumentException was thrown!"); } catch (ArgumentException) { } var password = _localPasswordGenerator.GeneratePassword(); var words = password.Split(' '); AssertEquals(12, words.Length, "Number of words"); } }
private void CheckRequestTypes() { using (Logger = new TestsessionLogger(_logger)) { var expectedRequestTypes = new List <string> { "addPeer", "approveTransaction", "blacklistPeer", "broadcastTransaction", "buyAlias", "calculateFullHash", "cancelAskOrder", "cancelBidOrder", "canDeleteCurrency", "castVote", "clearUnconfirmedTransactions", "createPoll", "currencyBuy", "currencyMint", "currencyReserveClaim", "currencyReserveIncrease", "currencySell", "decodeFileToken", "decodeHallmark", "decodeQRCode", "decodeToken", "decryptFrom", "deleteAccountProperty", "deleteAlias", "deleteAssetShares", "deleteCurrency", "detectMimeType", "dgsDelisting", "dgsDelivery", "dgsFeedback", "dgsListing", "dgsPriceChange", "dgsPurchase", "dgsQuantityChange", "dgsRefund", "dividendPayment", "downloadTaggedData", "dumpPeers", "encodeQRCode", "encryptTo", "eventRegister", "eventWait", "extendTaggedData", "fullHashToId", "fullReset", "generateFileToken", "generateToken", "getAccount", "getAccountAssetCount", "getAccountAssets", "getAccountBlockCount", "getAccountBlockIds", "getAccountBlocks", "getAccountCurrencies", "getAccountCurrencyCount", "getAccountCurrentAskOrderIds", "getAccountCurrentAskOrders", "getAccountCurrentBidOrderIds", "getAccountCurrentBidOrders", "getAccountExchangeRequests", "getAccountId", "getAccountLedger", "getAccountLedgerEntry", "getAccountLessors", "getAccountPhasedTransactionCount", "getAccountPhasedTransactions", "getAccountProperties", "getAccountPublicKey", "getAccountShufflings", "getAccountTaggedData", "getAlias", "getAliasCount", "getAliases", "getAliasesLike", "getAllAssets", "getAllBroadcastedTransactions", "getAllCurrencies", "getAllExchanges", "getAllOpenAskOrders", "getAllOpenBidOrders", "getAllPhasingOnlyControls", "getAllPrunableMessages", "getAllShufflings", "getAllTaggedData", "getAllTrades", "getAllWaitingTransactions", "getAskOrder", "getAskOrderIds", "getAskOrders", "getAsset", "getAssetAccountCount", "getAssetAccounts", "getAssetDeletes", "getAssetIds", "getAssetPhasedTransactions", "getAssets", "getAssetsByIssuer", "getAssetTransfers", "getAssignedShufflings", "getAvailableToBuy", "getAvailableToSell", "getBalance", "getBidOrder", "getBidOrderIds", "getBidOrders", "getBlock", "getBlockchainStatus", "getBlockchainTransactions", "getBlockId", "getBlocks", "getBuyOffers", "getChannelTaggedData", "getConstants", "getCurrencies", "getCurrenciesByIssuer", "getCurrency", "getCurrencyAccountCount", "getCurrencyAccounts", "getCurrencyFounders", "getCurrencyIds", "getCurrencyPhasedTransactions", "getCurrencyTransfers", "getDataTagCount", "getDataTags", "getDataTagsLike", "getDGSExpiredPurchases", "getDGSGood", "getDGSGoods", "getDGSGoodsCount", "getDGSGoodsPurchaseCount", "getDGSGoodsPurchases", "getDGSPendingPurchases", "getDGSPurchase", "getDGSPurchaseCount", "getDGSPurchases", "getDGSTagCount", "getDGSTags", "getDGSTagsLike", "getECBlock", "getExchanges", "getExchangesByExchangeRequest", "getExchangesByOffer", "getExpectedAskOrders", "getExpectedAssetDeletes", "getExpectedAssetTransfers", "getExpectedBidOrders", "getExpectedBuyOffers", "getExpectedCurrencyTransfers", "getExpectedExchangeRequests", "getExpectedOrderCancellations", "getExpectedSellOffers", "getExpectedTransactions", "getForging", "getGuaranteedBalance", "getHoldingShufflings", "getInboundPeers", "getLastExchanges", "getLastTrades", "getLinkedPhasedTransactions", "getLog", "getMintingTarget", "getMyInfo", "getOffer", "getOrderTrades", "getPeer", "getPeers", "getPhasingOnlyControl", "getPhasingPoll", "getPhasingPolls", "getPhasingPollVote", "getPhasingPollVotes", "getPlugins", "getPoll", "getPollResult", "getPolls", "getPollVote", "getPollVotes", "getPrunableMessage", "getPrunableMessages", "getReferencingTransactions", "getSellOffers", "getShufflers", "getShuffling", "getShufflingParticipants", "getStackTraces", "getState", "getTaggedData", "getTaggedDataExtendTransactions", "getTime", "getTrades", "getTransaction", "getTransactionBytes", "getUnconfirmedTransactionIds", "getUnconfirmedTransactions", "getVoterPhasedTransactions", "hash", "hexConvert", "issueAsset", "issueCurrency", "leaseBalance", "longConvert", "luceneReindex", "markHost", "parseTransaction", "placeAskOrder", "placeBidOrder", "popOff", "publishExchangeOffer", "readMessage", "rebroadcastUnconfirmedTransactions", "requeueUnconfirmedTransactions", "retrievePrunedData", "retrievePrunedTransaction", "rsConvert", "scan", "searchAccounts", "searchAssets", "searchCurrencies", "searchDGSGoods", "searchPolls", "searchTaggedData", "sellAlias", "sendMessage", "sendMoney", "setAccountInfo", "setAccountProperty", "setAlias", "setLogging", "setPhasingOnlyControl", "shufflingCancel", "shufflingCreate", "shufflingProcess", "shufflingRegister", "shufflingVerify", "shutdown", "signTransaction", "startForging", "startShuffler", "stopForging", "stopShuffler", "transferAsset", "transferCurrency", "trimDerivedTables", "uploadTaggedData", "verifyPrunableMessage", "verifyTaggedData" }; var requestTypes = _getConstantsReply.RequestTypes.ToList(); foreach (var requestType in requestTypes) { if (expectedRequestTypes.All(expected => expected != requestType.Name)) { Logger.Fail($"Missing request type: {requestType.Name}"); } } foreach (var expectedRequestType in expectedRequestTypes) { if (requestTypes.All(rt => rt.Name != expectedRequestType)) { Logger.Fail($"Missing request type: {expectedRequestType}"); } } } }