public void ShouldPreserveInstanceWhenValueIsCarouselTemplate() { var template = new CarouselTemplate() { Columns = new ICarouselColumn[] { new CarouselColumn() { ThumbnailUrl = new Uri("https://foo.bar"), Title = "CarouselTitle", Text = "CarouselText", Actions = new ITemplateAction[] { new MessageAction() { Label = "PostbackLabel", Text = "PostbackText" } } } } }; var carouselTemplate = CarouselTemplate.Convert(template); Assert.AreSame(template, carouselTemplate); var column = carouselTemplate.Columns.First(); Assert.AreSame(column, carouselTemplate.Columns.First()); }
public void ShouldThrowExceptionWhenColumnsIsNull() { var template = new CarouselTemplate(); ExceptionAssert.Throws <InvalidOperationException>("The columns cannot be null.", () => { CarouselTemplate.Convert(template); }); }
public void ShouldConvertCustomICarouselTemplateToCarouselTemplate() { var template = new TestCarouselTemplate(); var carouselTemplate = CarouselTemplate.Convert(template); Assert.AreNotEqual(template, carouselTemplate); var column = carouselTemplate.Columns.First() as CarouselColumn; Assert.AreEqual(new Uri("https://carousel.url"), column.ThumbnailUrl); Assert.AreEqual("CarouselTitle", column.Title); Assert.AreEqual("CarouselText", column.Text); var actions = column.Actions.ToArray(); var action = actions[0] as MessageAction; Assert.AreEqual("MessageLabel", action.Label); Assert.AreEqual("MessageText", action.Text); }