public async Task ClearMemPoolTestAsync() { // Act - Pause blockchain network actions CliResponse <string> pause = await _control.PauseAsync(tasks : NodeTask.All); // Assert Assert.IsEmpty(pause.Error); Assert.IsNotNull(pause.Result); Assert.IsInstanceOf <CliResponse <string> >(pause); // Act - Clear blockchain mem pool CliResponse <string> clearMemPool = await _control.ClearMemPoolAsync(); // Assert Assert.IsEmpty(pause.Error); Assert.IsNotNull(pause.Result); Assert.IsInstanceOf <CliResponse <string> >(clearMemPool); // Act - Resume blockchain network actions CliResponse <string> resume = await _control.ResumeAsync(tasks : NodeTask.All); // Assert Assert.IsEmpty(pause.Error); Assert.IsNotNull(pause.Result); Assert.IsInstanceOf <CliResponse <string> >(resume); }
public async Task GetRuntimeParamsTestAsync() { // Act - Ask blockchain network for runtime parameters CliResponse <GetRuntimeParamsResult> actual = await _control.GetRuntimeParamsAsync(); // Assert Assert.IsEmpty(actual.Error); Assert.IsNotNull(actual.Result); Assert.IsInstanceOf <CliResponse <GetRuntimeParamsResult> >(actual); }
public async Task GetInitStatusTestAsync() { // Act - Ask network for information about this blockchain CliResponse <GetInitStatusResult> actual = await _control.GetInitStatusAsync(); // Assert Assert.IsEmpty(actual.Error); Assert.IsNotNull(actual.Result); Assert.IsInstanceOf <CliResponse <GetInitStatusResult> >(actual); }
public async Task GetBlockchainParamsTestAsync() { // Act - Ask network for blockchain params CliResponse <GetBlockchainParamsResult> actual = await _control.GetBlockchainParamsAsync(display_names : true, with_upgrades : true); // Assert Assert.IsEmpty(actual.Error); Assert.IsNotNull(actual.Result); Assert.IsInstanceOf <CliResponse <GetBlockchainParamsResult> >(actual); }
public async Task SetLastBlockTestAsync() { // Act - Sets last block in blockchain CliResponse <string> actual = await _control.SetLastBlockAsync(hash_or_height : "60"); // Assert Assert.IsEmpty(actual.Error); Assert.IsNotNull(actual.Result); Assert.IsInstanceOf <CliResponse <string> >(actual); }
public async Task HelpTestAsync() { // Act - Get help information based on blockchain method name CliResponse <string> actual = await _control.HelpAsync(command : BlockchainAction.GetAssetInfoMethod); // Assert Assert.IsEmpty(actual.Error); Assert.IsNotNull(actual.Result); Assert.IsInstanceOf <CliResponse <string> >(actual); }
public static async Task Write(CliResponse cliResponse, HttpResponse httpResponse) { if (cliResponse is MultipleResponses multipleResponses) { await multipleResponses.Responses().ForEachAsync(async payload => { var json = Json(new StreamingResponse(payload, false)); await httpResponse.WriteAsync(Begin + json + End); await httpResponse.Body.FlushAsync(); }); } else { await httpResponse.WriteAsync(Begin + Json(cliResponse) + End); } }