public void GetTransferableShouldReturnValueById() { const ulong assetId = 123; var expected = new NxtAsset(assetId, "asset1", 0, new List <TipReaction>()); GetTransferableShouldReturnExpectedValue(expected, assetId.ToString()); }
public async void GetBalanceShouldTransferCorrectAmount(int decimals, decimal expected) { var asset = new NxtAsset(new Asset { AssetId = 234, Decimals = decimals, Name = "TEST" }, "", new List <string>(), new List <TipReaction>()); assetExchangeServiceMock.Setup(s => s.GetAccountAssets( It.Is <Account>(a => a.AccountRs == TestConstants.SenderAccount.NxtAccountRs), It.Is <ulong>(id => id == asset.Id), It.IsAny <bool?>(), It.IsAny <int?>(), It.IsAny <ulong?>(), It.IsAny <ulong?>())) .ReturnsAsync(new AccountAssetsReply { AccountAssets = new List <AccountAsset> { new AccountAsset { UnconfirmedQuantityQnt = 100 } } }); var balance = await nxtConnector.GetBalance(asset, TestConstants.SenderAccount.NxtAccountRs); Assert.Equal(expected, balance); }
public void GetTransferableShouldReturnValueByName() { const string assetname = "asset1"; var expected = new NxtAsset(123, assetname, 0, new List <TipReaction>()); GetTransferableShouldReturnExpectedValue(expected, assetname); }
private void GetTransferableShouldReturnExpectedValue(NxtAsset expected, string assetName) { transferables.AddTransferable(expected); var actual = transferables.GetTransferable(assetName); Assert.Same(expected, actual); }
public void AddTransferableShouldNotAllowDuplicateNames() { var asset1 = new NxtAsset(123, "asset1", 0, new List <TipReaction>()); var asset2 = new NxtAsset(234, "asset1", 0, new List <TipReaction>()); transferables.AddTransferable(asset1); Assert.Throws <ArgumentException>(() => transferables.AddTransferable(asset2)); }
public void GetTransferableShouldReturnValueByMoniker() { const string moniker = "assetmoniker"; var expected = new NxtAsset(new NxtLib.AssetExchange.Asset { AssetId = 123, Decimals = 0, Name = "asset1" }, "", new List <string> { moniker }, new List <TipReaction>()); GetTransferableShouldReturnExpectedValue(expected, moniker); }
public void AddTransferableShouldNotAllowDuplicateMonikerNames() { var asset1 = new NxtAsset(123, "asset1", 0, new List <TipReaction>()); var asset2 = new NxtAsset(new NxtLib.AssetExchange.Asset { AssetId = 234, Decimals = 0, Name = "asset2" }, "", new List <string> { "asset1" }, new List <TipReaction>()); transferables.AddTransferable(asset1); Assert.Throws <ArgumentException>(() => transferables.AddTransferable(asset2)); }