Example #1
0
            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);
            }
Example #2
0
            public async Task ReturnsNullIdWhenResponseContainsWhitespace()
            {
                TestHttpClient httpClient = TestHttpClient.Create(JsonDocuments.Whitespace);
                ILineBot       bot        = TestConfiguration.CreateBot(httpClient);
                var            id         = await bot.GetDefaultRichMenu();

                Assert.IsNull(id);
            }
Example #3
0
            public async Task ReturnsNullIdWhenResponseContainsEmptyObject()
            {
                TestHttpClient httpClient = TestHttpClient.Create(EmptyObjectJson);
                ILineBot       bot        = TestConfiguration.CreateBot(httpClient);
                var            id         = await bot.GetDefaultRichMenu();

                Assert.IsNull(id);
            }
Example #4
0
            public async Task ThrowsExceptionWhenResponseIsError()
            {
                TestHttpClient httpClient = TestHttpClient.ThatReturnsAnError();
                ILineBot       bot        = TestConfiguration.CreateBot(httpClient);

                await ExceptionAssert.ThrowsAsync <LineBotException>("Unknown error", async() =>
                {
                    await bot.GetDefaultRichMenu();
                });
            }