|
1 | 1 | using System; |
| 2 | +using System.Linq; |
2 | 3 | using System.Net; |
3 | 4 | using System.Net.Http; |
4 | 5 | using System.Threading.Tasks; |
@@ -167,6 +168,63 @@ public void GetRatesAsync_WithInvalidCurrencyCode_ShouldThrowExceptionAsync(stri |
167 | 168 | Assert.That(ex!.Message, Is.EqualTo("Value cannot be null or white space (Parameter 'currencyCode')")); |
168 | 169 | } |
169 | 170 |
|
| 171 | + [Test] |
| 172 | + [TestCase("31C3EC186C367DA66DFBD0E576D6170A2C1AB846BFC35FC0B49D202F2A8CDFD8")] |
| 173 | + public async Task GetHookInfoAsync_WithValidHookHash_ShouldReturnHookInfoAsync(string hookHash) |
| 174 | + { |
| 175 | + // Arrange |
| 176 | + _httpMessageHandlerMock.SetFixtureMessage(HttpStatusCode.OK, "hookhash"); |
| 177 | + |
| 178 | + // Act |
| 179 | + var result = await _subject.GetHookInfoAsync(hookHash); |
| 180 | + |
| 181 | + // Assert |
| 182 | + AssertExtensions.AreEqual(hookHash, result.HookHash); |
| 183 | + AssertExtensions.AreEqual(MiscFixtures.XummHookInfo, result.HookInfo); |
| 184 | + } |
| 185 | + |
| 186 | + [Test] |
| 187 | + [TestCase("31C3EC186C367DA66DFBD0E576D6170A2C1AB846BFC35FC0B49D202F2A8CDFD8")] |
| 188 | + public async Task GetHookInfoAsync_WithValidHookHash_ShouldContainHookHashInRequestUriAsync(string hookHash) |
| 189 | + { |
| 190 | + // Arrange |
| 191 | + _httpMessageHandlerMock.SetFixtureMessage(HttpStatusCode.OK, "hookhash"); |
| 192 | + |
| 193 | + // Act |
| 194 | + _ = await _subject.GetHookInfoAsync(hookHash); |
| 195 | + |
| 196 | + // Assert |
| 197 | + _httpMessageHandlerMock.AssertRequestUri(HttpMethod.Get, $"/hookhash/{hookHash}"); |
| 198 | + } |
| 199 | + |
| 200 | + [Test] |
| 201 | + [TestCase(null)] |
| 202 | + [TestCase("")] |
| 203 | + [TestCase(" ")] |
| 204 | + public void GetHookInfoAsync_WithInvalidTxHash_ShouldThrowExceptionAsync(string hookHash) |
| 205 | + { |
| 206 | + // Act |
| 207 | + var ex = Assert.ThrowsAsync<ArgumentException>(() => _subject.GetHookInfoAsync(hookHash)); |
| 208 | + |
| 209 | + // Assert |
| 210 | + Assert.IsNotNull(ex); |
| 211 | + Assert.That(ex!.Message, Is.EqualTo("Invalid Hook Hash (expecting SHA-512Half) (Parameter 'hookHash')")); |
| 212 | + } |
| 213 | + |
| 214 | + [Test] |
| 215 | + public async Task GetAllHookInfosAsync_ShouldReturnHookInfosAsync() |
| 216 | + { |
| 217 | + // Arrange |
| 218 | + _httpMessageHandlerMock.SetFixtureMessage(HttpStatusCode.OK, "hookhashes"); |
| 219 | + |
| 220 | + // Act |
| 221 | + var result = await _subject.GetAllHookInfosAsync(); |
| 222 | + |
| 223 | + // Assert |
| 224 | + AssertExtensions.AreEqual(MiscFixtures.XummHookHash, result.First().HookHash); |
| 225 | + AssertExtensions.AreEqual(MiscFixtures.XummHookInfo, result.First().HookInfo); |
| 226 | + } |
| 227 | + |
170 | 228 | [Test] |
171 | 229 | [TestCase("C3951A3229506DB2C505ED248EFD3BBD8F232C7684732F38270BE9DE90F75134")] |
172 | 230 | public async Task GetTransactionAsync_WithValidTxHash_ShouldReturnTransactionAsync(string txHash) |
@@ -206,7 +264,7 @@ public void GetTransactionAsync_WithInvalidTxHash_ShouldThrowExceptionAsync(stri |
206 | 264 |
|
207 | 265 | // Assert |
208 | 266 | Assert.IsNotNull(ex); |
209 | | - Assert.That(ex!.Message, Is.EqualTo("Value cannot be null or white space (Parameter 'txHash')")); |
| 267 | + Assert.That(ex!.Message, Is.EqualTo("Invalid Transaction Hash (expecting SHA-512Half) (Parameter 'txHash')")); |
210 | 268 | } |
211 | 269 |
|
212 | 270 | [Test] |
|
0 commit comments