示例#1
0
        public void Constructor_Sets_Initial_Values()
        {
            this.mockContractState.Setup(s => s.Message.Sender).Returns(RequestorAddress);

            var contract = new HelloBlockchain(this.mockContractState.Object, "Test");

            this.mockPersistentState.Verify(s => s.SetAddress(nameof(HelloBlockchain.Requestor), RequestorAddress), Times.Once);
            this.mockPersistentState.Verify(s => s.SetString(nameof(HelloBlockchain.RequestMessage), "Test"), Times.Once);
            this.mockPersistentState.Verify(s => s.SetUInt32(nameof(HelloBlockchain.State), (uint)HelloBlockchain.StateType.Request), Times.Once);
        }
示例#2
0
        private HelloBlockchain NewHelloBlockchain()
        {
            this.mockPersistentState.Setup(s => s.GetAddress(nameof(HelloBlockchain.Requestor))).Returns(RequestorAddress);
            this.mockPersistentState.Setup(s => s.GetString(nameof(HelloBlockchain.RequestMessage))).Returns("Test");

            var result = new HelloBlockchain(this.mockContractState.Object, "Test");

            // Clear the constructor invocations
            this.mockPersistentState.Invocations.Clear();

            return(result);
        }