public override BytesValue GetRandomBytes(BytesValue input) { var height = new Int64Value(); height.MergeFrom(input.Value); return(GetRandomHash(height).ToBytesValue()); }
public async Task GetRandomBytesTest_Int64() { var stub = await DeployRandomNumberProviderContract(); var randomIntegers = new List <long>(); for (var i = 0; i < 5; i++) { var randomBytes = await stub.GetRandomBytes.CallAsync(new GetRandomBytesInput { Kind = 2, Value = HashHelper.ComputeFrom("Test2").ToByteString() }.ToBytesValue()); var randomNumber = new Int64Value(); randomNumber.MergeFrom(randomBytes.Value); randomNumber.Value.ShouldBePositive(); randomNumber.Value.ShouldBeLessThan(10000); await stub.GetRandomBytes.SendAsync(new GetRandomBytesInput { Kind = 2, Value = HashHelper.ComputeFrom("Test2").ToByteString() }.ToBytesValue()); randomIntegers.Add(randomNumber.Value); } randomIntegers.Count.ShouldBe(5); }