Пример #1
0
        public void GetTransferableShouldReturnValueById()
        {
            const ulong assetId  = 123;
            var         expected = new NxtAsset(assetId, "asset1", 0, new List <TipReaction>());

            GetTransferableShouldReturnExpectedValue(expected, assetId.ToString());
        }
Пример #2
0
        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);
        }
Пример #3
0
        public void GetTransferableShouldReturnValueByName()
        {
            const string assetname = "asset1";
            var          expected  = new NxtAsset(123, assetname, 0, new List <TipReaction>());

            GetTransferableShouldReturnExpectedValue(expected, assetname);
        }
Пример #4
0
        private void GetTransferableShouldReturnExpectedValue(NxtAsset expected, string assetName)
        {
            transferables.AddTransferable(expected);

            var actual = transferables.GetTransferable(assetName);

            Assert.Same(expected, actual);
        }
Пример #5
0
        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));
        }
Пример #6
0
        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);
        }
Пример #7
0
        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));
        }