Exemplo n.º 1
0
 private void AssertPermissionSet(Access expected, PermissionSet permissions)
 {
     Assert.Equal(expected, permissions.AccountModify);
     Assert.Equal(expected, permissions.AccountNegative);
     Assert.Equal(expected, permissions.AccountSpend);
     Assert.Equal(expected, permissions.DataModify);
 }
        private static async Task TestAccountChange(PermissionSet accountPermissions, long previousBalance, long newBalance)
        {
            PermissionBasedValidator validator = CreateValidator(
                new string[0],
                new Dictionary<string, PermissionSet>()
                {
                    ["/"] = PermissionSet.Unset,
                    ["/a/"] = accountPermissions
                });

            Dictionary<AccountKey, AccountStatus> accounts = new Dictionary<AccountKey, AccountStatus>()
            {
                [AccountKey.Parse("/a/", "/b/")] = new AccountStatus(AccountKey.Parse("/a/", "/b/"), previousBalance, ByteString.Empty)
            };

            ParsedMutation mutation = new ParsedMutation(
                new[] { new AccountStatus(AccountKey.Parse("/a/", "/b/"), newBalance, ByteString.Empty) },
                new KeyValuePair<RecordKey, ByteString>[0]);

            await validator.Validate(mutation, new SignatureEvidence[0], accounts);
        }