コード例 #1
0
            public void ShouldConvertCustomIRichMenuBoundsToRichMenuBounds()
            {
                var richMenu = new TestRichMenu();

                var convertedRichMenu = RichMenu.Convert(richMenu);

                Assert.AreNotSame(richMenu, convertedRichMenu);
                Assert.AreNotSame(richMenu.Areas, convertedRichMenu.Areas);
                Assert.AreNotSame(richMenu.Size, convertedRichMenu.Size);
            }
コード例 #2
0
            public async Task ShouldCreateRichMenu()
            {
                var richMenu = new TestRichMenu();

                var richMenuIdJson = @"{""richMenuId"": ""richmenu-801b2cd26b2f13587329ed501d279d27""}";
                var httpClient     = TestHttpClient.ThatReturnsData(Encoding.ASCII.GetBytes(richMenuIdJson));

                var bot    = TestConfiguration.CreateBot(httpClient);
                var result = await bot.CreateRichMenu(richMenu);

                Assert.AreEqual("/richmenu", httpClient.RequestPath);

                string postedData =
                    @"{""areas"":[{""action"":{""type"":""uri"",""label"":""testLabel"",""uri"":""http://www.google.com""},""bounds"":{""x"":11,""y"":12,""width"":110,""height"":120}},{""action"":{""type"":""uri"",""label"":""testLabel2"",""uri"":""http://www.bing.com""},""bounds"":{""x"":21,""y"":22,""width"":210,""height"":220}}],""chatBarText"":""testChatBarTxt"",""name"":""testName"",""selected"":false,""size"":{""width"":2500,""height"":1686}}";

                Assert.AreEqual(postedData, httpClient.PostedData);

                Assert.AreEqual(result, "richmenu-801b2cd26b2f13587329ed501d279d27");
            }