public async Task AfterDeployment_BalanceOwner_ShouldBeTheSameAsInitialSupply(int initialSupply) { var contractDeploymentDefault = GetDeploymentMessage(); contractDeploymentDefault.InitialAmount = initialSupply; GivenADeployedContract(contractDeploymentDefault); var balanceOfExpecedResult = new BalanceOfOutputDTO() { Balance = initialSupply }; WhenQueryingThen(SimpleStandardContractTest.GetBalanceOfOwnerMessage(), balanceOfExpecedResult); }
public async Task Transfering_ShouldIncreaseTheBalanceOfReceiver(int valueToSend) { var contractDeploymentDefault = SimpleStandardContractTest.GetDeploymentMessage(); Assert.False(valueToSend > contractDeploymentDefault.InitialAmount, "value to send is bigger than the total supply, please adjust the test data"); GivenADeployedContract(contractDeploymentDefault); var receiver = SimpleStandardContractTest.ReceiverAddress; var transferMessage = new TransferFunction() { Value = valueToSend, FromAddress = DefaultTestAccountConstants.Address, To = receiver, }; var expectedEvent = new TransferEventDTO() { From = DefaultTestAccountConstants.Address.ToLower(), To = SimpleStandardContractTest.ReceiverAddress.ToLower(), Value = valueToSend }; GivenATransaction(transferMessage). ThenExpectAnEvent(expectedEvent); var queryBalanceReceiverMessage = new BalanceOfFunction() { Owner = ReceiverAddress }; var balanceOfExpectedResult = new BalanceOfOutputDTO() { Balance = valueToSend }; WhenQuerying <BalanceOfFunction, BalanceOfOutputDTO>(queryBalanceReceiverMessage) .ThenExpectResult(balanceOfExpectedResult); }