示例#1
0
        public void AllowsToMint()
        {
            Address  addressC = new PrivateKey().ToAddress();
            Currency currency = new Currency(ticker: "FOO", minter: AddressA);

            Assert.True(currency.AllowsToMint(AddressA));
            Assert.False(currency.AllowsToMint(AddressB));
            Assert.False(currency.AllowsToMint(addressC));

            currency = new Currency(
                ticker: "BAR",
                minters: ImmutableHashSet.Create(AddressA, AddressB)
                );
            Assert.True(currency.AllowsToMint(AddressA));
            Assert.True(currency.AllowsToMint(AddressB));
            Assert.False(currency.AllowsToMint(addressC));

            currency = new Currency(ticker: "BAZ", minters: ImmutableHashSet <Address> .Empty);
            Assert.False(currency.AllowsToMint(AddressA));
            Assert.False(currency.AllowsToMint(AddressB));
            Assert.False(currency.AllowsToMint(addressC));

            currency = new Currency(ticker: "QUX", minter: null);
            Assert.True(currency.AllowsToMint(AddressA));
            Assert.True(currency.AllowsToMint(AddressB));
            Assert.True(currency.AllowsToMint(addressC));
        }