public void ShouldThrowExceptionWhenActionsIsNull() { var column = new CarouselColumn() { ThumbnailUrl = new Uri("https://foo.bar"), Text = "CarouselColumnText", Title = "CarouselColumnTitle" }; ExceptionAssert.Throws <InvalidOperationException>("The actions cannot be null.", () => { CarouselColumn.Convert(new[] { column }).ToArray(); }); }
public void ShouldThrowExceptionWhenTextIsNull() { var column = new CarouselColumn() { ThumbnailUrl = new Uri("https://foo.bar"), Title = "CarouselColumnTitle", Actions = new ITemplateAction[] { new PostbackAction() } }; ExceptionAssert.Throws <InvalidOperationException>("The text cannot be null.", () => { CarouselColumn.Convert(new[] { column }).ToArray(); }); }
public void ShouldConvertCustomICarouselColumnToCarouselColumn() { var column = new TestCarouselColumn(); var columns = CarouselColumn.Convert(new[] { column }).ToArray(); Assert.AreEqual(1, columns.Length); Assert.AreNotEqual(column, columns[0]); var carouselColumn = columns[0] as CarouselColumn; Assert.AreEqual(new Uri("https://carousel.url/"), carouselColumn.ThumbnailUrl); Assert.AreEqual("CarouselTitle", carouselColumn.Title); Assert.AreEqual("CarouselText", carouselColumn.Text); var actions = carouselColumn.Actions.ToArray(); var action = actions[0] as MessageAction; Assert.AreEqual("MessageLabel", action.Label); Assert.AreEqual("MessageText", action.Text); }
public void ShouldPreserveInstanceWhenValueIsCarouselColumn() { var column = new CarouselColumn() { ThumbnailUrl = new Uri("https://foo.bar"), Text = "CarouselColumnText", Title = "CarouselColumnTitle", Actions = new ITemplateAction[] { new PostbackAction() { Label = "PostbackLabel", Text = "PostbackText", Data = "PostbackData", } } }; var columns = CarouselColumn.Convert(new[] { column }).ToArray(); Assert.AreEqual(1, columns.Length); Assert.AreSame(column, columns[0]); }