public async Task GetContent_MessageIsEmpty_ThrowsException() { ILineBot bot = TestConfiguration.CreateBot(); await ExceptionAssert.ThrowsArgumentEmptyExceptionAsync("messageId", async() => { await bot.GetContent(string.Empty); }); }
public async Task GetContent_MessageIdIsNull_ThrowsException() { ILineBot bot = TestConfiguration.CreateBot(); await ExceptionAssert.ThrowsArgumentNullExceptionAsync("messageId", async() => { await bot.GetContent((string)null); }); }
public async Task GetContent_ErrorResponse_ThrowsException() { TestHttpClient httpClient = TestHttpClient.ThatReturnsAnError(); ILineBot bot = TestConfiguration.CreateBot(httpClient); await ExceptionAssert.ThrowsUnknownError(async() => { await bot.GetContent("test"); }); }
public async Task GetContent_EmptyResponse_ReturnsNull() { TestHttpClient httpClient = TestHttpClient.Create(); ILineBot bot = TestConfiguration.CreateBot(httpClient); byte[] data = await bot.GetContent("test"); Assert.AreEqual(HttpMethod.Get, httpClient.RequestMethod); Assert.AreEqual("/message/test/content", httpClient.RequestPath); Assert.IsNull(data); }
public async Task GetContent_WithMessage_ReturnsData() { 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.GetContent(new TestMessage(MessageType.Image)); Assert.AreEqual(HttpMethod.Get, httpClient.RequestMethod); Assert.AreEqual("/message/testMessage/content", httpClient.RequestPath); Assert.IsNotNull(data); CollectionAssert.AreEqual(data, input); }