public async Task ThrowsExceptionWhenMessageIsEmpty() { ILineBot bot = TestConfiguration.CreateBot(); await ExceptionAssert.ThrowsArgumentEmptyExceptionAsync("messageId", async() => { await bot.GetMessageContent(string.Empty); }); }
public async Task ThrowsExceptionWhenMessageIdIsNull() { ILineBot bot = TestConfiguration.CreateBot(); await ExceptionAssert.ThrowsArgumentNullExceptionAsync("messageId", async() => { await bot.GetMessageContent((string)null); }); }
public async Task ThrowsExceptionWhenResponseIsError() { TestHttpClient httpClient = TestHttpClient.ThatReturnsAnError(); ILineBot bot = TestConfiguration.CreateBot(httpClient); await ExceptionAssert.ThrowsUnknownError(async() => { await bot.GetMessageContent("test"); }); }
public async Task ReturnsNullWhenResponseIsEmpty() { TestHttpClient httpClient = TestHttpClient.Create(); ILineBot bot = TestConfiguration.CreateBot(httpClient); byte[] data = await bot.GetMessageContent("test"); Assert.AreEqual(HttpMethod.Get, httpClient.RequestMethod); Assert.AreEqual("/message/test/content", httpClient.RequestPath); Assert.IsNull(data); }
public async Task ReturnsDataWhenWithCorrectMessageId() { byte[] input = new byte[12] { 68, 105, 114, 107, 32, 76, 101, 109, 115, 116, 114, 97 }; TestHttpClient httpClient = TestHttpClient.ThatReturnsData(input); ILineBot bot = TestConfiguration.CreateBot(httpClient); byte[] data = await bot.GetMessageContent("test"); Assert.AreEqual(HttpMethod.Get, httpClient.RequestMethod); Assert.AreEqual("/message/test/content", httpClient.RequestPath); Assert.IsNotNull(data); CollectionAssert.AreEqual(data, input); }