Exemplo n.º 1
0
 public async Task ThrowsExceptionWhenMessageIsEmpty()
 {
     ILineBot bot = TestConfiguration.CreateBot();
     await ExceptionAssert.ThrowsArgumentEmptyExceptionAsync("messageId", async() =>
     {
         await bot.GetMessageContent(string.Empty);
     });
 }
Exemplo n.º 2
0
 public async Task ThrowsExceptionWhenMessageIdIsNull()
 {
     ILineBot bot = TestConfiguration.CreateBot();
     await ExceptionAssert.ThrowsArgumentNullExceptionAsync("messageId", async() =>
     {
         await bot.GetMessageContent((string)null);
     });
 }
Exemplo n.º 3
0
            public async Task ThrowsExceptionWhenResponseIsError()
            {
                TestHttpClient httpClient = TestHttpClient.ThatReturnsAnError();

                ILineBot bot = TestConfiguration.CreateBot(httpClient);

                await ExceptionAssert.ThrowsUnknownError(async() =>
                {
                    await bot.GetMessageContent("test");
                });
            }
Exemplo n.º 4
0
            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);
            }
Exemplo n.º 5
0
            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);
            }