public async Task ReturnsIdWhenResponseIsCorrect() { TestHttpClient httpClient = TestHttpClient.Create(JsonDocuments.RichMenu.DefaultRichMenuId); ILineBot bot = TestConfiguration.CreateBot(httpClient); var id = await bot.GetDefaultRichMenu(); Assert.AreEqual("110FB567-E204-4131-9669-DB828CE65D2F", id); }
public async Task ReturnsNullIdWhenResponseContainsWhitespace() { TestHttpClient httpClient = TestHttpClient.Create(JsonDocuments.Whitespace); ILineBot bot = TestConfiguration.CreateBot(httpClient); var id = await bot.GetDefaultRichMenu(); Assert.IsNull(id); }
public async Task ReturnsNullIdWhenResponseContainsEmptyObject() { TestHttpClient httpClient = TestHttpClient.Create(EmptyObjectJson); ILineBot bot = TestConfiguration.CreateBot(httpClient); var id = await bot.GetDefaultRichMenu(); Assert.IsNull(id); }
public async Task ThrowsExceptionWhenResponseIsError() { TestHttpClient httpClient = TestHttpClient.ThatReturnsAnError(); ILineBot bot = TestConfiguration.CreateBot(httpClient); await ExceptionAssert.ThrowsAsync <LineBotException>("Unknown error", async() => { await bot.GetDefaultRichMenu(); }); }