public void Constructor_Sets_TotalSupply() { this.mockContractState.Setup(m => m.Message).Returns(new Message(this.contract, this.owner, 0)); ulong totalSupply = 100_000; var standardToken = new StandardToken(this.mockContractState.Object, totalSupply, this.name, this.symbol); // Verify that PersistentState was called with the total supply this.mockPersistentState.Verify(s => s.SetUInt64(nameof(StandardToken.TotalSupply), totalSupply)); }
public void Constructor_Assigns_TotalSupply_To_Owner() { ulong totalSupply = 100_000; this.mockContractState.Setup(m => m.Message).Returns(new Message(this.contract, this.owner, 0)); var standardToken = new StandardToken(this.mockContractState.Object, totalSupply, this.name, this.symbol); // Verify that PersistentState was called with the total supply this.mockPersistentState.Verify(s => s.SetUInt64($"Balance:{this.owner}", totalSupply)); }
public StandardTokenTests() { var network = new SmartContractsRegTest(); this.TestAddress = "0x0000000000000000000000000000000000000001".HexToAddress(); this.ta2 = "0x0000000000000000000000000000000000000002".HexToAddress(); this.ta3 = "0x0000000000000000000000000000000000000003".HexToAddress(); this.ta4 = "0x0000000000000000000000000000000000000004".HexToAddress(); this.ta5 = "0x0000000000000000000000000000000000000005".HexToAddress(); var block = new TestBlock { Coinbase = this.TestAddress, Number = 1 }; var message = new TestMessage { ContractAddress = this.TestAddress, Sender = this.TestAddress, Value = Value }; var getBalance = new Func <ulong>(() => Balance); var persistentState = new TestPersistentState(); var serializer = new Serializer(new ContractPrimitiveSerializer(network)); this.smartContractState = new TestSmartContractState( block, message, persistentState, serializer, null, null, getBalance, null, null ); ulong totalSupply = 1000_000; string name = "TestToken"; string symbol = "TST"; this.contract = new StandardToken(this.smartContractState, totalSupply, name, symbol); }