public async Task GetBlockData_500_LogsErrorReturnsNull() { // Arrange _httpTest.RespondWith(status: 500); _blockStoreService = new BlockStoreService(_nodeOptions.Object, _logger.Object); // Act var result = await _blockStoreService.GetBlockDataAsync("hx78s8dj3uuiwejfuew98f8wef8"); // Assert _logger.VerifyLog(LogLevel.Error); Assert.That(result, Is.Null); }
public async Task GetBlockData_200_ReturnsResponse() { // Arrange var receipt = new Receipt <BlockDto, object> { ReturnValue = new BlockDto { Height = 1000 } }; _httpTest.RespondWithJson(receipt, status: 200); _blockStoreService = new BlockStoreService(_nodeOptions.Object, _logger.Object); // Act var result = await _blockStoreService.GetBlockDataAsync("hx78s8dj3uuiwejfuew98f8wef8"); // Assert var expected = JsonConvert.SerializeObject(receipt.ReturnValue); var actual = JsonConvert.SerializeObject(result); Assert.That(actual, Is.EqualTo(expected)); }