コード例 #1
0
            public void ShouldThrowExceptionWhenImageUrlIsNull()
            {
                var column = new ImageCarouselColumn()
                {
                    Action = new PostbackAction()
                };

                ExceptionAssert.Throws <InvalidOperationException>("The image url cannot be null.", () =>
                {
                    ImageCarouselColumn.Convert(new[] { column }).ToArray();
                });
            }
コード例 #2
0
            public void ShouldThrowExceptionWhenActionIsNull()
            {
                var column = new ImageCarouselColumn()
                {
                    ImageUrl = new Uri("https://foo.bar"),
                };

                ExceptionAssert.Throws <InvalidOperationException>("The action cannot be null.", () =>
                {
                    ImageCarouselColumn.Convert(new[] { column }).ToArray();
                });
            }
コード例 #3
0
            public void ShouldConvertCustomIImageCarouselColumnToImageCarouselColumn()
            {
                var column = new TestImageCarouselColumn();

                var columns = ImageCarouselColumn.Convert(new[] { column }).ToArray();

                Assert.AreEqual(1, columns.Length);
                Assert.AreNotEqual(column, columns[0]);

                var carouselColumn = columns[0] as ImageCarouselColumn;

                Assert.AreEqual(new Uri("https://carousel.url"), carouselColumn.ImageUrl);

                var action = carouselColumn.Action as MessageAction;

                Assert.AreEqual("MessageLabel", action.Label);
                Assert.AreEqual("MessageText", action.Text);
            }
コード例 #4
0
            public void ShouldPreserveInstanceWhenValueIsImageCarouselColumn()
            {
                var column = new ImageCarouselColumn()
                {
                    ImageUrl = new Uri("https://foo.bar"),
                    Action   = new PostbackAction()
                    {
                        Label = "PostbackLabel",
                        Text  = "PostbackText",
                        Data  = "PostbackData",
                    }
                };

                var columns = ImageCarouselColumn.Convert(new[] { column }).ToArray();

                Assert.AreEqual(1, columns.Length);
                Assert.AreSame(column, columns[0]);
            }